From 33fefdb44992bce18acb4548f28c9cd5b31de11f Mon Sep 17 00:00:00 2001 From: Christophe Gisquet Date: Wed, 13 Aug 2014 18:40:17 +0200 Subject: ffmpeg: fix streamcopy with side data The issue is that, when the main packet data buffer is changed, streamcopy uses a temporary new packet to store that buffer, frees the old packet, and replace it with the new packet. However, in doing so, it forgets about the side data, which gets freed, but is still needed and referenced. Then, when the packet gets freed again in the normal code path, it attempts to free its side data which has already been freed. Therefore, simply avoid the first free on side data by removing that side data from the packet. Fixes ticket #3773. Signed-off-by: Michael Niedermayer --- ffmpeg.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ffmpeg.c') diff --git a/ffmpeg.c b/ffmpeg.c index b82d2be398..60b10cce5b 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -627,6 +627,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) a = AVERROR(ENOMEM); } if (a > 0) { + pkt->side_data = NULL; + pkt->side_data_elems = 0; av_free_packet(pkt); new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, av_buffer_default_free, NULL, 0); -- cgit v1.2.3