You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
avformat/mp3enc: use av_copy_packet()
Fixes double free Fixes Ticket3476 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@ -417,14 +417,14 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (mp3->pics_to_write) {
|
if (mp3->pics_to_write) {
|
||||||
/* buffer audio packets until we get all the pictures */
|
/* buffer audio packets until we get all the pictures */
|
||||||
AVPacketList *pktl = av_mallocz(sizeof(*pktl));
|
AVPacketList *pktl = av_mallocz(sizeof(*pktl));
|
||||||
|
int ret;
|
||||||
if (!pktl)
|
if (!pktl)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
pktl->pkt = *pkt;
|
ret = av_copy_packet(&pktl->pkt, pkt);
|
||||||
pktl->pkt.buf = av_buffer_ref(pkt->buf);
|
if (ret < 0) {
|
||||||
if (!pktl->pkt.buf) {
|
|
||||||
av_freep(&pktl);
|
av_freep(&pktl);
|
||||||
return AVERROR(ENOMEM);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp3->queue_end)
|
if (mp3->queue_end)
|
||||||
|
Reference in New Issue
Block a user