Fix potential memory leak in argz_replace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		
				
					committed by
					
						 Corinna Vinschen
						Corinna Vinschen
					
				
			
			
				
	
			
			
			
						parent
						
							4f3cc70cb6
						
					
				
				
					commit
					ca632c9015
				
			| @@ -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> | 2015-05-26  DJ Delorie  <dj@redhat.com> | ||||||
|  |  | ||||||
| 	* libm/math/e_sqrt.c (__ieee754_sqrt): Don't truncate constant to | 	* 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. */ |       /* reallocate argz, and copy over the new value. */ | ||||||
|       if(!(*argz = (char *)realloc(*argz, new_argz_len))) |       if(!(*argz = (char *)realloc(*argz, new_argz_len))) | ||||||
|  |         { | ||||||
|  |           free(new_argz); | ||||||
|           return ENOMEM; |           return ENOMEM; | ||||||
|  |         } | ||||||
|  |  | ||||||
|       memcpy(*argz, new_argz, new_argz_len); |       memcpy(*argz, new_argz, new_argz_len); | ||||||
|       *argz_len = new_argz_len; |       *argz_len = new_argz_len; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user