printf: don't leak serialised pointer extension strings

This commit is contained in:
Tim-Philipp Müller 2013-04-07 17:21:10 +01:00 committed by Tim-Philipp Müller
parent 9a9b449c5f
commit 6d8a6470d5

View file

@ -260,10 +260,15 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
errno = EINVAL;
return NULL;
}
#define CLEANUP() \
free (d.dir); \
if (a.arg) \
free (a.arg);
#define CLEANUP() \
free (d.dir); \
if (a.arg) { \
while (a.count--) { \
if (a.arg[a.count].ext_string) \
free (a.arg[a.count].ext_string); \
} \
free (a.arg); \
}
if (printf_fetchargs (args, &a) < 0) {
CLEANUP ();