From 6d8a6470d59142ff1de3841894bb33e71d133566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 7 Apr 2013 17:21:10 +0100 Subject: [PATCH] printf: don't leak serialised pointer extension strings --- gst/printf/vasnprintf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gst/printf/vasnprintf.c b/gst/printf/vasnprintf.c index 315688c2b7..f20d3bc703 100644 --- a/gst/printf/vasnprintf.c +++ b/gst/printf/vasnprintf.c @@ -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 ();