[m-rev.] for review: mslice and mdice

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Apr 4 17:02:16 AEST 2005


On 01-Apr-2005, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> trace/mercury_trace_internal.c:
...
> 	Fix several places where we weren't checking the return value of
> 	malloc. Fix two places where we could conceivably free strings that
> 	were still alive. Fix some places where we could pass NULL strings
> 	to Mercury code, and some places where we could free NULL pointers
> 	(which is not guaranteed to work on all platforms).

FYI: ISO C guarantees that calling free() with a null pointer will have
no effect.  So it should be fine to write

	free(ptr);

rather than

	if (ptr) {
		free(ptr);
	}

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list