Skip to content
Snippets Groups Projects
Commit 5472fbf9 authored by deuce's avatar deuce
Browse files

Be sure to free() the temporary string buffer of the realloc() of the format

fails.
parent 967b6d8f
No related branches found
No related tags found
No related merge requests found
...@@ -1090,8 +1090,11 @@ char *xp_asprintf_next(char *format, int type, ...) ...@@ -1090,8 +1090,11 @@ char *xp_asprintf_next(char *format, int type, ...)
* the string. * the string.
*/ */
newbuf=(char *)realloc(format, format_len-this_format_len+j+1); newbuf=(char *)realloc(format, format_len-this_format_len+j+1);
if(newbuf==NULL) if(newbuf==NULL) {
if(entry != entry_buf)
free(entry);
return(NULL); return(NULL);
}
format=newbuf; format=newbuf;
/* Move trailing end to make space */ /* Move trailing end to make space */
memmove(format+offset+j, format+offset+this_format_len, offset+format_len-this_format_len+1); memmove(format+offset+j, format+offset+this_format_len, offset+format_len-this_format_len+1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment