IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 22 years ago

Closed 22 years ago

Last modified 21 years ago

#233 closed defect (fixed)

p_psFree calls psError, but returns void

Reported by: Paul Price Owned by: robert.desonia@…
Priority: low Milestone:
Component: sys Version: 0.3.0
Severity: trivial Keywords:
Cc:

Description

p_psFree calls psError (pushing an error onto the stack), but returns void, so
that the error is lost. Two possible solutions are:
(1) Have psFree return a bool, but this makes the API different from the regular
free call.
(2) Remove psError, perhaps replacing with an abort?

I suggest (2).

Change History (4)

comment:1 by robert.desonia@…, 22 years ago

Owner: changed from robert.desonia@… to Paul Price

The typical psFree errors are memory corruption and freeing an already fully
dereferenced memory block (e.g., 'multiple-freeing'). I am not sure if these
types of errors are of sufficient severity to warrent an immediate abort from
the program.

The error generated by psFree (i.e., p_psFree) still gets pushed on the error
stack, so if one want to catch an error from psFree, one can to use psErrorLast
after the call (and psErrorClear before the call to be safe).

If psFree does return a bool, I'm not sure if that would be a problem in
reality. If the return value of psFree is ignored (which is perfectly
acceptable in C), the syntax would still be the same as free.

-rdd

comment:2 by Paul Price, 22 years ago

Owner: changed from Paul Price to robert.desonia@…

Discussed with Gene, and we agreed that:
(1) Explicitly checking either the return value of psFree, or explicitly
checking the error stack after calling psFree goes against the philosophy of the
PS memory management. Calls to the memory management functions occur so often
that we don't want to have to check each call explicitly.
(2) The error only occurs in the case where a block of memory has been freed one
too many times. This is a programming error, which should be caught.

Given (1) and (2), the only logical behaviour is to have psFree do an abort.

comment:3 by robert.desonia@…, 22 years ago

Resolution: fixed
Status: newclosed

made suggested change in CVS head.

comment:4 by Paul Price, 21 years ago

Verified.

Note: See TracTickets for help on using tickets.