[FFmpeg-cvslog] oggdec: fix memleak on header parsing failure

Michael Niedermayer git at videolan.org
Tue Nov 20 15:24:27 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 20 15:12:37 2012 +0100| [07a866282f08985c65c47ebabcf7b20f1c46daa0] | committer: Michael Niedermayer

oggdec: fix memleak on header parsing failure

Fixes Ticket1931

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/oggdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 0fce898..3ca33dc 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -57,6 +57,7 @@ static const struct ogg_codec * const ogg_codecs[] = {
 };
 
 static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts);
+static int ogg_read_close(AVFormatContext *s);
 
 //FIXME We could avoid some structure duplication
 static int ogg_save(AVFormatContext *s)
@@ -596,8 +597,10 @@ static int ogg_read_header(AVFormatContext *s)
     //linear headers seek from start
     do {
         ret = ogg_packet(s, NULL, NULL, NULL, NULL);
-        if (ret < 0)
+        if (ret < 0) {
+            ogg_read_close(s);
             return ret;
+        }
     } while (!ogg->headers);
     av_dlog(s, "found headers\n");
 



More information about the ffmpeg-cvslog mailing list