]> git.sesse.net Git - vlc/commitdiff
* Fixed another bunch of memory leaks.
authorGildas Bazin <gbazin@videolan.org>
Sun, 8 Oct 2006 16:09:13 +0000 (16:09 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 8 Oct 2006 16:09:13 +0000 (16:09 +0000)
include/vlc_es.h
modules/codec/faad.c
modules/demux/avi/libavi.c
modules/demux/mpeg/mpga.c
modules/video_output/x11/xcommon.c

index b00142a97961e60bc635dd73a1339c53ec4d71b6..f9d36bd1c5ef3993bea1be03ecfea2b35e713a13 100644 (file)
@@ -245,7 +245,9 @@ static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
     }
 
     dst->i_extra_languages = src->i_extra_languages;
-    dst->p_extra_languages = (extra_languages_t*) malloc( dst->i_extra_languages * sizeof(*dst->p_extra_languages ) );
+    if( dst->i_extra_languages )
+        dst->p_extra_languages = (extra_languages_t*)
+            malloc(dst->i_extra_languages * sizeof(*dst->p_extra_languages ));
     for( i = 0; i < dst->i_extra_languages; i++ ) {
         if( src->p_extra_languages[i].psz_language )
             dst->p_extra_languages[i].psz_language = strdup(src->p_extra_languages[i].psz_language);
index 26b01a13a61b7961da650b65969fd1c87e8b9be8..36361f48ff14db62c1747c529679afed94aefdac 100644 (file)
@@ -404,6 +404,7 @@ static void Close( vlc_object_t *p_this )
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     faacDecClose( p_sys->hfaad );
+    if( p_sys->p_buffer ) free( p_sys->p_buffer );
     free( p_sys );
 }
 
index b9c3a14d86a9d503b0ce860ff9211f1f6d35aece..0caa5b47df414505863366160466b16dd9ea888a 100644 (file)
@@ -426,12 +426,15 @@ static int AVI_ChunkRead_strd( stream_t *s, avi_chunk_t *p_chk )
 {
     AVI_READCHUNK_ENTER;
     p_chk->strd.p_data = malloc( p_chk->common.i_chunk_size );
-    memcpy( p_chk->strd.p_data,
-            p_buff + 8,
-            p_chk->common.i_chunk_size );
+    memcpy( p_chk->strd.p_data, p_buff + 8, p_chk->common.i_chunk_size );
     AVI_READCHUNK_EXIT( VLC_SUCCESS );
 }
 
+static void AVI_ChunkFree_strd( avi_chunk_t *p_chk )
+{
+    if( p_chk->strd.p_data ) free( p_chk->strd.p_data );
+}
+
 static int AVI_ChunkRead_idx1( stream_t *s, avi_chunk_t *p_chk )
 {
     unsigned int i_count, i_index;
@@ -651,7 +654,7 @@ static struct
     { AVIFOURCC_avih, AVI_ChunkRead_avih, AVI_ChunkFree_nothing },
     { AVIFOURCC_strh, AVI_ChunkRead_strh, AVI_ChunkFree_nothing },
     { AVIFOURCC_strf, AVI_ChunkRead_strf, AVI_ChunkFree_strf },
-    { AVIFOURCC_strd, AVI_ChunkRead_strd, AVI_ChunkFree_nothing },
+    { AVIFOURCC_strd, AVI_ChunkRead_strd, AVI_ChunkFree_strd },
     { AVIFOURCC_idx1, AVI_ChunkRead_idx1, AVI_ChunkFree_idx1 },
     { AVIFOURCC_indx, AVI_ChunkRead_indx, AVI_ChunkFree_indx },
     { AVIFOURCC_JUNK, AVI_ChunkRead_nothing, AVI_ChunkFree_nothing },
index a5692bfb0481d2e0dc81f196287f489b77e7eb94..cbcc000e3945e7c39b4c337169c3a27563e5083e 100644 (file)
@@ -285,7 +285,9 @@ static int Demux( demux_t *p_demux )
     {
         p_sys->b_start = VLC_FALSE;
         p_block_in = p_sys->p_block_in;
+        p_sys->p_block_in = NULL;
         p_block_out = p_sys->p_block_out;
+        p_sys->p_block_out = NULL;
     }
     else
     {
@@ -337,6 +339,8 @@ static void Close( vlc_object_t * p_this )
 
     DESTROY_PACKETIZER( p_sys->p_packetizer );
     if( p_sys->meta ) vlc_meta_Delete( p_sys->meta );
+    if( p_sys->p_block_in ) block_Release( p_sys->p_block_in );
+    if( p_sys->p_block_out ) block_Release( p_sys->p_block_out );
 
     free( p_sys );
 }
index 8a6252a52d4ed9d3f7e390b02fc52f81e1742c62..f481b487ebb6747adb68bc2691a9453d589ea3b9 100644 (file)
@@ -1094,6 +1094,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
                     XStoreName( p_vout->p_sys->p_display,
                                p_win->base_window, val.psz_string );
                 }
+                if( val.psz_string ) free( val.psz_string );
             }
         }
     }
@@ -2116,6 +2117,8 @@ static int InitDisplay( vout_thread_t *p_vout )
                 }
             }
         }
+        if( p_formats ) XFree( p_formats );
+
         break;
     }
     p_vout->p_sys->p_visual = p_xvisual->visual;