[FFmpeg-cvslog] examples/demuxing: free AVPacket after usage

Angelo Haller git at videolan.org
Tue Jan 15 23:38:29 CET 2013


ffmpeg | branch: master | Angelo Haller <angelo at szanni.org> | Tue Jan 15 23:37:08 2013 +0100| [e7a39e163ddbde85f966132194143d0338445a0c] | committer: Stefano Sabatini

examples/demuxing: free AVPacket after usage

Fix leak.

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

 doc/examples/demuxing.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/examples/demuxing.c b/doc/examples/demuxing.c
index bee21b7..6780e07 100644
--- a/doc/examples/demuxing.c
+++ b/doc/examples/demuxing.c
@@ -292,8 +292,10 @@ int main (int argc, char **argv)
         printf("Demuxing audio from file '%s' into '%s'\n", src_filename, audio_dst_filename);
 
     /* read frames from the file */
-    while (av_read_frame(fmt_ctx, &pkt) >= 0)
+    while (av_read_frame(fmt_ctx, &pkt) >= 0) {
         decode_packet(&got_frame, 0);
+        av_free_packet(&pkt);
+    }
 
     /* flush cached frames */
     pkt.data = NULL;



More information about the ffmpeg-cvslog mailing list