changeset 1466:340d1fe645d3 libavformat

* fixing a memory leak in DV format. Patch by Brian Brice bbrice at newtek dot com
author romansh
date Wed, 08 Nov 2006 18:57:02 +0000
parents 1dccf2603e1d
children 24c082e20a6a
files dvenc.c
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dvenc.c	Wed Nov 08 18:53:36 2006 +0000
+++ b/dvenc.c	Wed Nov 08 18:57:02 2006 +0000
@@ -279,7 +279,7 @@
 
 DVMuxContext* dv_init_mux(AVFormatContext* s)
 {
-    DVMuxContext *c;
+    DVMuxContext *c = (DVMuxContext *)s->priv_data;
     AVStream *vst = NULL;
     int i;
 
@@ -287,10 +287,6 @@
     if (s->nb_streams > 3)
         return NULL;
 
-    c = av_mallocz(sizeof(DVMuxContext));
-    if (!c)
-        return NULL;
-
     c->n_ast = 0;
     c->ast[0] = c->ast[1] = NULL;
 
@@ -345,7 +341,6 @@
     return c;
 
 bail_out:
-    av_free(c);
     return NULL;
 }
 
@@ -359,8 +354,7 @@
 #ifdef CONFIG_MUXERS
 static int dv_write_header(AVFormatContext *s)
 {
-    s->priv_data = dv_init_mux(s);
-    if (!s->priv_data) {
+    if (!dv_init_mux(s)) {
         av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n"
                     "Make sure that you supply exactly two streams:\n"
                     "     video: 25fps or 29.97fps, audio: 2ch/48Khz/PCM\n"