changeset 2870:d2c5c911280d libavformat

fix memory leak (patch by Gabriel Fort gforte _at_ wyplay _dot_ com)
author aurel
date Sat, 29 Dec 2007 18:30:27 +0000
parents 02e909632f18
children b2f261fccb0b
files matroskadec.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Sat Dec 29 16:34:51 2007 +0000
+++ b/matroskadec.c	Sat Dec 29 18:30:27 2007 +0000
@@ -2268,8 +2268,10 @@
         av_free(origdata);
         return res;
     }
-    if (matroska->tracks[track]->stream_index < 0)
+    if (matroska->tracks[track]->stream_index < 0) {
+        av_free(origdata);
         return res;
+    }
     st = matroska->ctx->streams[matroska->tracks[track]->stream_index];
     if (st->discard >= AVDISCARD_ALL) {
         av_free(origdata);
@@ -2287,8 +2289,10 @@
         is_keyframe = flags & 0x80 ? PKT_FLAG_KEY : 0;
 
     if (matroska->skip_to_keyframe) {
-        if (!is_keyframe || st != matroska->skip_to_stream)
+        if (!is_keyframe || st != matroska->skip_to_stream) {
+            av_free(origdata);
             return res;
+        }
         matroska->skip_to_keyframe = 0;
     }