From 4b20b21b8dabc74d676404dea94d43569a54a6b1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 11 Oct 2012 16:51:08 +0200 Subject: [PATCH] tiff: fix leak on error return in doubles2str() Fixes CID733797 Signed-off-by: Michael Niedermayer --- libavcodec/tiff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 1093180d00..bb11a23d19 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -216,8 +216,10 @@ static char *doubles2str(double *dp, int count, const char *sep) ap[0] = '\0'; for (i = 0; i < count; i++) { unsigned l = snprintf(ap, component_len, "%f%s", dp[i], sep); - if(l >= component_len) + if(l >= component_len) { + av_free(ap0); return NULL; + } ap += l; } ap0[strlen(ap0) - strlen(sep)] = '\0';