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)
committerStefano Sabatini <stefasab@gmail.com>
Tue, 21 Jan 2014 19:08:36 +0000 (20:08 +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

libavformat/segment.c

index 91c143272b4956d2a1d99cbaddcace93fda09c98..bf5f4fb407efe68a74c08bb48bd85eb9c152ee73 100644 (file)
@@ -731,12 +731,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;
 }