[FFmpeg-cvslog] libavformat/libopenmpt: Fix memory leak in error path in read_header_openmpt().

Jörn Heusipp git at videolan.org
Sun Jul 17 17:50:15 CEST 2016


ffmpeg | branch: master | Jörn Heusipp <osmanx at problemloesungsmaschine.de> | Sun Jul 17 15:37:12 2016 +0200| [f1eb6ddcb34f4d27d52d4a0a30269728612c41b0] | committer: Michael Niedermayer

libavformat/libopenmpt: Fix memory leak in error path in read_header_openmpt().

Signed-off-by: Jörn Heusipp <osmanx at problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c
index fd38828..58a02be 100644
--- a/libavformat/libopenmpt.c
+++ b/libavformat/libopenmpt.c
@@ -89,8 +89,11 @@ static int read_header_openmpt(AVFormatContext *s)
     add_meta(s, "comment", openmpt_module_get_metadata(openmpt->module, "message"));
 
     st = avformat_new_stream(s, NULL);
-    if (!st)
+    if (!st) {
+        openmpt_module_destroy(openmpt->module);
+        openmpt->module = NULL;
         return AVERROR(ENOMEM);
+    }
     avpriv_set_pts_info(st, 64, 1, 1000);
     if (st->duration > 0)
         st->duration = llrint(openmpt->duration*AV_TIME_BASE);
@@ -146,6 +149,7 @@ static int read_close_openmpt(AVFormatContext *s)
 {
     OpenMPTContext *openmpt = s->priv_data;
     openmpt_module_destroy(openmpt->module);
+    openmpt->module = NULL;
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list