segment: Check open_null_ctx() return value
authorVittorio Giovara <vittorio.giovara@gmail.com>
Fri, 12 Jun 2015 12:39:16 +0000 (13:39 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Fri, 12 Jun 2015 16:02:48 +0000 (17:02 +0100)
Reported-By: infer
libavformat/segment.c

index 55ba656..3479134 100644 (file)
@@ -351,7 +351,8 @@ static int seg_write_trailer(struct AVFormatContext *s)
     if (!seg->write_header_trailer) {
         if ((ret = segment_end(oc, 0)) < 0)
             goto fail;
-        open_null_ctx(&oc->pb);
+        if ((ret = open_null_ctx(&oc->pb)) < 0)
+            goto fail;
         ret = av_write_trailer(oc);
         close_null_ctx(oc->pb);
     } else {