Re: Memory leak in ev.c, the second

2013-02-21 Thread Alexander Klauer
Hi, On 02/20/2013 06:16 PM, Marc Lehmann wrote: On Wed, Feb 20, 2013 at 05:28:57PM +0100, Alexander Klauer alexander.kla...@itwm.fraunhofer.de wrote: semantics as a call to free(ptr). A C89-conformant implementation may return a unique non-NULL pointer which may be safely passed to free().

Re: Memory leak in ev.c, the second

2013-02-21 Thread Alexander Klauer
D'oh, will I ever get it right? Find the correct version of libev.c attached. Best regards, Alexander #includeassert.h #includeev.h #includestdlib.h static void * allocator( void * ptr, long size ) { assert( ( size = 0 ) ( ( unsigned long ) size = ( size_t ) -1 ) ); return realloc( ptr,

Re: Memory leak in ev.c, the second

2013-02-21 Thread Marc Lehmann
On Thu, Feb 21, 2013 at 10:39:20AM +0100, Alexander Klauer alexander.kla...@itwm.fraunhofer.de wrote: 1. if size is equal to zero, and ptr is not NULL, then the call is equivalent to free(ptr). The last assertion is incorrect. See 4. for a proof on concept in libev below. That assertion was