From 712ee85816ef854761f30ea57ea628997bd62e60 Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 2 Oct 2017 18:58:39 -0300 Subject: [PATCH] avcodec/encode: free non-referenced packets' side data in the old encode API functions Fixes memleaks introduced by a22c6a4796ca1f2cbee6784262515da876fbec22. --- libavcodec/encode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index dd50486bcf..c152228c92 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -227,6 +227,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, ret = av_packet_ref(&tmp, avpkt); if (ret < 0) return ret; + av_packet_unref(avpkt); *avpkt = tmp; } } @@ -325,6 +326,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, ret = av_packet_ref(&tmp, avpkt); if (ret < 0) return ret; + av_packet_unref(avpkt); *avpkt = tmp; } }