avformat/utils: Keep internal and external av_read_frame() packets in sync.
authorDale Curtis <dalecurtis@chromium.org>
Wed, 22 May 2013 22:17:08 +0000 (15:17 -0700)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 23 May 2013 01:29:47 +0000 (03:29 +0200)
Otherwise, during error conditions, the caller will be left with
dangling pointers to a destructed packet => boom.

BUG=242786
TEST=ffmpeg_regression_tests

Commit slightly simplified by commiter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 0c40aa9..2c62d30 100644 (file)
@@ -1506,6 +1506,9 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
             st->skip_to_keyframe = 0;
         if (st->skip_to_keyframe) {
             av_free_packet(&cur_pkt);
+            if (got_packet) {
+                *pkt = cur_pkt;
+            }
             got_packet = 0;
         }
     }