Fix potential memory leak in argz_replace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
ecfe018c65
commit
3710583ebb
|
@ -1,3 +1,7 @@
|
|||
2015-05-27 David Stacey <drstacey@tiscali.co.uk>
|
||||
|
||||
* libc/argz/argz_replace.c: Fix potential memory leak.
|
||||
|
||||
2015-05-26 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* libm/math/e_sqrt.c (__ieee754_sqrt): Don't truncate constant to
|
||||
|
|
|
@ -71,7 +71,10 @@ _DEFUN (argz_replace, (argz, argz_len, str, with, replace_count),
|
|||
|
||||
/* reallocate argz, and copy over the new value. */
|
||||
if(!(*argz = (char *)realloc(*argz, new_argz_len)))
|
||||
{
|
||||
free(new_argz);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(*argz, new_argz, new_argz_len);
|
||||
*argz_len = new_argz_len;
|
||||
|
|
Loading…
Reference in New Issue