[FFmpeg-devel] [PATCH] lavc/utils: fix audio frame memleak in case of non refcounted frames.

Clément Bœsch ubitux at gmail.com
Tue Mar 19 22:49:35 CET 2013


This is a simple code duplication from what's in the decode video
function. This change notably fixes leaks with the metadata filter
tests.
---
 libavcodec/utils.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b245914..424ffab 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2116,6 +2116,13 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
 
         if (ret < 0 && frame->data[0])
             av_frame_unref(frame);
+
+        if (*got_frame_ptr) {
+            if (!avctx->refcounted_frames) {
+                avci->to_free = *frame;
+                avci->to_free.extended_data = avci->to_free.data;
+            }
+        }
     }
 
     /* many decoders assign whole AVFrames, thus overwriting extended_data;
-- 
1.8.2



More information about the ffmpeg-devel mailing list