Memory leak in ev.c, the second
Marc Lehmann
schmorp at schmorp.de
Wed Feb 20 18:16:01 CET 2013
On Wed, Feb 20, 2013 at 05:28:57PM +0100, Alexander Klauer <Alexander.Klauer at 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().
And when does this happen *in libev*? realloc frees the memory for cases
where the ptr is != 0 and size = 0, which is all that libev relies on. And
currently, the default allocator calls free in all cases where size == 0
for portability.
> The attached patch changes ev_realloc_emul() so that
> ev_realloc_emul(ptr, 0) has free(ptr) semantics in all cases.
When sending patches you should always check current sources, because that
patch has already been applied, for other reasons.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the libev
mailing list