mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-10-04 17:44:49 +02:00
avcodec/encode: do proper cleanup on failure
Fixes the last remaining memleaks introduced by a22c6a4796
.
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
ef973bd98d
commit
87e625c263
@ -225,9 +225,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
|||||||
} else if (!avpkt->buf) {
|
} else if (!avpkt->buf) {
|
||||||
AVPacket tmp = { 0 };
|
AVPacket tmp = { 0 };
|
||||||
ret = av_packet_ref(&tmp, avpkt);
|
ret = av_packet_ref(&tmp, avpkt);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
av_packet_unref(avpkt);
|
av_packet_unref(avpkt);
|
||||||
|
if (ret < 0)
|
||||||
|
goto end;
|
||||||
*avpkt = tmp;
|
*avpkt = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,9 +324,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
|
|||||||
} else if (!avpkt->buf) {
|
} else if (!avpkt->buf) {
|
||||||
AVPacket tmp = { 0 };
|
AVPacket tmp = { 0 };
|
||||||
ret = av_packet_ref(&tmp, avpkt);
|
ret = av_packet_ref(&tmp, avpkt);
|
||||||
|
av_packet_unref(avpkt);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
av_packet_unref(avpkt);
|
|
||||||
*avpkt = tmp;
|
*avpkt = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user