lavf/segment: remove duplicated and inconsistent cleanup code in seg_write_packet()
authorStefano Sabatini <stefasab@gmail.com>
Tue, 21 Jan 2014 18:58:41 +0000 (19:58 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 13 Mar 2015 16:06:08 +0000 (17:06 +0100)
In particular, avoid to leave around the seg->avf pointer to freed
structure, and fix crash with:
ffmpeg -f lavfi -i testsrc -c:v h264 -map 0 -f segment foo-%d.ts
(cherry picked from commit 169065fbfb3da1ab776379c333aebc54bb1f1bc4)

Found-by: Qinghao Tang
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/segment.c

index efc35c8..76616f8 100644 (file)
@@ -656,12 +656,6 @@ fail:
     if (pkt->stream_index == seg->reference_stream_index)
         seg->frame_count++;
 
-    if (ret < 0) {
-        if (seg->list)
-            avio_close(seg->list_pb);
-        avformat_free_context(oc);
-    }
-
     return ret;
 }