asprintf in low memory situations

Jeff Johnston jjohnstn@redhat.com
Fri Jul 16 21:41:00 GMT 2004


Thomas Rauscher wrote:
> Hi,
> 
> it seems that NEWLIB's asprintf does not
> free an allocated buffer in fp->_bf._base
> when a call to _realloc_r() fails.
> 
> This is somewhat different to the BSD and GLIBC
> implementation. BSD LIBC seems to call free() and 
> set the return pointer to NULL while GLIBC 
> (according to man page) seems to call free()
> and return the now invalid pointer.
> 
> I'm just curious whether this is a design issue or a bug.

It is a bug and has just been fixed in the cvs sources.  The storage is now
freed.


-- Jeff J.



More information about the Newlib mailing list