[FFmpeg-devel] [PATCH 1/3] examples/muxing: fix av_frame_free() not called when got_packet is false

Ilya Basin basinilya at gmail.com
Mon Dec 16 10:05:51 CET 2013


Hi list! Since my last patch (fix 2 memleaks in doc/examples/muxing.c)
I found more problems to fix.
---
 doc/examples/muxing.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 9ad6e28..5f716c2 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -269,7 +269,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
     }
 
     if (!got_packet)
-        return;
+        goto freeframe;
 
     pkt.stream_index = st->index;
 
@@ -280,6 +280,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
                 av_err2str(ret));
         exit(1);
     }
+freeframe:
     av_frame_free(&frame);
 }
 
-- 
1.7.9



More information about the ffmpeg-devel mailing list