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 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(). And when does this happen *in libev*?

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 #include #include #include static void * allocator( void * ptr, long size ) { assert( ( size >= 0 ) && ( ( unsigned long ) size <= ( size_t ) -1 ) ); return realloc( ptr, size ); } int main

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 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 correct until reletively recent