This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Potential memory leak in argz_replace.c


On 27/05/2015 11:16, Corinna Vinschen wrote:
However, there appear to be more issues with this function.  E.g., when
allocating new_argz, it's never tested if the allocation worked.  Also,
the expression `*argz = (char *)realloc(*argz, new_argz_len)', when
failing, will overwrite *argz with NULL.  When that happens the caller
potentially loses its (un-free'd) argz pointer with no way to recover.

Care to fix those as well?

'Twould be a pleasure.

Dave.

newlib/ChangeLog
2015-05-31  David Stacey <drstacey@tiscali.co.uk>

* libc/argz/argz_replace.c: Corrected behaviour when memory is exhausted.

Attachment: argz_replace.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]