[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug: {m,re}alloc expects live pointers form {m,re}alloc(0) (patch includ

From: Yuri Vasilevski
Subject: bug: {m,re}alloc expects live pointers form {m,re}alloc(0) (patch included)
Date: Mon, 5 Sep 2005 10:58:11 -0500


The xmalloc and xrealloc functions defined in lib/xmalloc.c expect live
pointers to be always returned form system's malloc and realloc
function. This is an invalid assumption for most (all?) libc
implementations including glibc in realloc [1], and an invalid
assumption for many libc's like uClibc in malloc.

The patch I include makes xmalloc/xrealloc behave the same way whatever
we decide to use system's malloc/realloc or glibc's ones (maybe with
help of rpl_malloc/rpl_realloc) doing boundary checking and out of
memory checking when this makes sense (i.e. when we request a positive
amount of memory).

[1] form man 3 malloc: realloc() .... if size is equal to zero,
    the  call is equivalent to free(ptr). ...


PS: please CC me on replays as I'm not subscribed to the list.

Attachment: diffutils-2.8.7-r1-malloc.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]