]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpeg: fix memleak of sub_name on error
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Nov 2014 18:17:34 +0000 (19:17 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Nov 2014 18:17:34 +0000 (19:17 +0100)
Fixes CID1254666

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mpeg.c

index e8e1b085c8a25b8868870857bd189980352ee64c..827a3c2c5f8b0a15364100bcddae344495130bea 100644 (file)
@@ -697,12 +697,16 @@ static int vobsub_read_header(AVFormatContext *s)
     memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3);
     av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name);
 
-    if (!(iformat = av_find_input_format("mpeg")))
-        return AVERROR_DEMUXER_NOT_FOUND;
+    if (!(iformat = av_find_input_format("mpeg"))) {
+        ret = AVERROR_DEMUXER_NOT_FOUND;
+        goto end;
+    }
 
     vobsub->sub_ctx = avformat_alloc_context();
-    if (!vobsub->sub_ctx)
-        return AVERROR(ENOMEM);
+    if (!vobsub->sub_ctx) {
+        ret = AVERROR(ENOMEM);
+        goto end;
+    }
 
     if ((ret = ff_copy_whitelists(vobsub->sub_ctx, s)) < 0)
         goto end;