mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
Fix double free in __printf_fp_l (bug 26214).
__printf_fp_l has a double free bug in the case where it allocates memory with malloc internally, then has an I/O error while outputting trailing padding and tries to free that already-freed memory when the error occurs. This patch fixes this by setting the relevant pointer to NULL after the first free (the only free of this pointer that isn't immediately followed by returning from the function). Tested for x86_64 and x86.
This commit is contained in:
@@ -1250,6 +1250,9 @@ __printf_fp_l (FILE *fp, locale_t loc,
|
||||
{
|
||||
free (buffer);
|
||||
free (wbuffer);
|
||||
/* Avoid a double free if the subsequent PADN encounters an
|
||||
I/O error. */
|
||||
wbuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user