mirror of https://git.ffmpeg.org/ffmpeg.git
lavc/utils: fix metadata audio frame memleak in case of non refcounted frames.
The metadata must be set before saving the frame to avci->to_free, otherwise it will leak. Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Clément Bœsch <ubitux@gmail.com>
This commit is contained in:
parent
76fdced109
commit
4331484b8d
|
@ -2051,6 +2051,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
||||||
avctx->pkt = &tmp;
|
avctx->pkt = &tmp;
|
||||||
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
|
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
|
||||||
if (ret >= 0 && *got_frame_ptr) {
|
if (ret >= 0 && *got_frame_ptr) {
|
||||||
|
add_metadata_from_side_data(avctx, frame);
|
||||||
avctx->frame_number++;
|
avctx->frame_number++;
|
||||||
frame->pkt_dts = avpkt->dts;
|
frame->pkt_dts = avpkt->dts;
|
||||||
av_frame_set_best_effort_timestamp(frame,
|
av_frame_set_best_effort_timestamp(frame,
|
||||||
|
@ -2070,7 +2071,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
||||||
avci->to_free.extended_data = avci->to_free.data;
|
avci->to_free.extended_data = avci->to_free.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_metadata_from_side_data(avctx, frame);
|
|
||||||
|
|
||||||
side= av_packet_get_side_data(avctx->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
|
side= av_packet_get_side_data(avctx->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
|
||||||
if(side && side_size>=10) {
|
if(side && side_size>=10) {
|
||||||
|
|
Loading…
Reference in New Issue