summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-08-13 18:40:17 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-15 03:43:17 +0200
commit33fefdb44992bce18acb4548f28c9cd5b31de11f (patch)
treee76261422d0185860bc0ccb8148cb7eaa2418d40 /ffmpeg.c
parent6c1ee1a11446abbe662fc89b9dff0f0a3d5fdd55 (diff)
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 <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c2
1 files changed, 2 insertions, 0 deletions
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);