wtvdec: fix memleak on error
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 13 Oct 2012 00:37:47 +0000 (02:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 13 Oct 2012 00:37:47 +0000 (02:37 +0200)
Fixes CID718002
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/wtvdec.c

index 319b986..a8dc506 100644 (file)
@@ -580,8 +580,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code
         if (!wst)
             return NULL;
         st = avformat_new_stream(s, NULL);
         if (!wst)
             return NULL;
         st = avformat_new_stream(s, NULL);
-        if (!st)
+        if (!st) {
+            av_free(wst);
             return NULL;
             return NULL;
+        }
         st->id = sid;
         st->priv_data = wst;
     }
         st->id = sid;
         st->priv_data = wst;
     }