]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/libopusenc: Don't free user-provided AVPacket
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 23 May 2020 09:40:23 +0000 (11:40 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 23 May 2020 18:24:37 +0000 (20:24 +0200)
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/libopusenc.c

index 7c025a66d7778200069cef54ed6914eb12313a32..13017ac323e02596ab2889d3a259177275f0a5c1 100644 (file)
@@ -503,7 +503,6 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
     // Check if subtraction resulted in an overflow
     if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) {
         av_packet_unref(avpkt);
-        av_free(avpkt);
         return AVERROR(EINVAL);
     }
     if (discard_padding > 0) {
@@ -512,7 +511,6 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
                                                      10);
         if(!side_data) {
             av_packet_unref(avpkt);
-            av_free(avpkt);
             return AVERROR(ENOMEM);
         }
         AV_WL32(side_data + 4, discard_padding);