diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-03-22 01:26:48 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-23 15:10:06 +0200 |
commit | 4201c7454551c87364a4cdcaed638b01520af635 (patch) | |
tree | 42a357972efcc2eed1ec0a8e09f92fc3947d3eaf /libavformat | |
parent | 946810d1da50b39b07af0f8102783539068214c5 (diff) | |
download | ffmpeg-4201c7454551c87364a4cdcaed638b01520af635.tar.gz |
avformat/mp3enc: use av_copy_packet()
Fixes double free
Fixes Ticket3476
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d003a0cd2e587a47627fd328f9fc5a484adc29f2)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mp3enc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index a5f672b257..209ddca1f2 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -414,14 +414,14 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt) if (mp3->pics_to_write) { /* buffer audio packets until we get all the pictures */ AVPacketList *pktl = av_mallocz(sizeof(*pktl)); + int ret; if (!pktl) return AVERROR(ENOMEM); - pktl->pkt = *pkt; - pktl->pkt.buf = av_buffer_ref(pkt->buf); - if (!pktl->pkt.buf) { + ret = av_copy_packet(&pktl->pkt, pkt); + if (ret < 0) { av_freep(&pktl); - return AVERROR(ENOMEM); + return ret; } if (mp3->queue_end) |