[FFmpeg-cvslog] avcodec/libfdk-aacenc: Remove redundant av_packet_unref()

Andreas Rheinhardt git at videolan.org
Sat Mar 18 08:34:59 EET 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Mar 13 05:03:52 2023 +0100| [e5abcf0d290df85b78b9f52d52e824a7f1123d11] | committer: Andreas Rheinhardt

avcodec/libfdk-aacenc: Remove redundant av_packet_unref()

The AVPacket given to an encoder's encode callback
is unreferenced generically on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/libfdk-aacenc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index db5b0841e0..eb97e0fb41 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -475,16 +475,13 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     // Check if subtraction resulted in an overflow
     if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) {
         av_log(avctx, AV_LOG_ERROR, "discard padding overflow\n");
-        av_packet_unref(avpkt);
         return AVERROR(EINVAL);
     }
     if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding > 0) {
         uint8_t *side_data =
             av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
-        if (!side_data) {
-            av_packet_unref(avpkt);
+        if (!side_data)
             return AVERROR(ENOMEM);
-        }
         if (!s->delay_sent) {
             AV_WL32(side_data, avctx->initial_padding);
             s->delay_sent = 1;



More information about the ffmpeg-cvslog mailing list