[FFmpeg-cvslog] avcodec/encode: free non-referenced packets' side data in the old encode API functions

James Almer git at videolan.org
Tue Oct 3 01:13:22 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Oct  2 18:58:39 2017 -0300| [712ee85816ef854761f30ea57ea628997bd62e60] | committer: James Almer

avcodec/encode: free non-referenced packets' side data in the old encode API functions

Fixes memleaks introduced by a22c6a4796ca1f2cbee6784262515da876fbec22.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=712ee85816ef854761f30ea57ea628997bd62e60
---

 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;
         }
     }



More information about the ffmpeg-cvslog mailing list