changeset 36572:12ed11a8df90

demux_rawdv: Fix memory leak on open error.
author reimar
date Mon, 20 Jan 2014 22:08:37 +0000
parents 689594b793f7
children acf727068104
files libmpdemux/demux_rawdv.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_rawdv.c	Mon Jan 20 22:08:36 2014 +0000
+++ b/libmpdemux/demux_rawdv.c	Mon Jan 20 22:08:37 2014 +0000
@@ -160,12 +160,12 @@
    dv_decoder->quality=DV_QUALITY_BEST;
 
    if (dv_parse_header(dv_decoder, dv_frame) == -1)
-	   return NULL;
+	   goto err_out;
 
    // create a new video stream header
    sh_video = new_sh_video(demuxer, 0);
    if (!sh_video)
-	   return NULL;
+	   goto err_out;
 
    // make sure the demuxer knows about the new video stream header
    // (even though new_sh_video() ought to take care of it)
@@ -230,6 +230,11 @@
    dv_decoder_free(dv_decoder);  //we keep this in the context of both stream headers
    demuxer->priv=frames;
    return demuxer;
+
+err_out:
+   if (dv_decoder) dv_decoder_free(dv_decoder);
+   free(frames);
+   return NULL;
 }
 
 static void demux_close_rawdv(demuxer_t* demuxer)