From: Paul B Mahol <[email protected]>

Signed-off-by: Paul B Mahol <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/segment.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 1af412a..05f76a7 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -174,11 +174,13 @@ static int seg_write_header(AVFormatContext *s)
 
 fail:
     if (ret) {
-        oc->streams = NULL;
-        oc->nb_streams = 0;
+        if (oc) {
+            oc->streams = NULL;
+            oc->nb_streams = 0;
+            avformat_free_context(oc);
+        }
         if (seg->list)
             avio_close(seg->pb);
-        avformat_free_context(oc);
     }
     return ret;
 }
-- 
1.7.5.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to