[vlc-devel] commit: IFO: memory leak ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Oct 5 21:59:17 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct  5 22:58:36 2009 +0300| [3455d5b00302b5aa88bc53e1ccb1cc3de51c9b6b] | committer: Rémi Denis-Courmont 

IFO: memory leak

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3455d5b00302b5aa88bc53e1ccb1cc3de51c9b6b
---

 modules/demux/playlist/ifo.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/demux/playlist/ifo.c b/modules/demux/playlist/ifo.c
index 6923a52..a432711 100644
--- a/modules/demux/playlist/ifo.c
+++ b/modules/demux/playlist/ifo.c
@@ -84,22 +84,22 @@ void Close_IFO( vlc_object_t *p_this )
 
 static int Demux( demux_t *p_demux )
 {
-    char *psz_url = NULL;
-    size_t len = 0;
-    input_item_t *p_input;
+    size_t len = strlen( "dvd://" ) + strlen( p_demux->psz_path )
+               - strlen( "VIDEO_TS.IFO" );
+    char *psz_url;
 
-    input_item_t *p_current_input = GetCurrentItem(p_demux);
-
-    len = strlen( "dvd://" ) + strlen( p_demux->psz_path )
-          - strlen( "VIDEO_TS.IFO" );
-    psz_url = (char *)malloc( len+1 );
+    psz_url = malloc( len+1 );
+    if( !psz_url )
+        return 0;
     snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path );
 
-    p_input = input_item_New( p_demux, psz_url, psz_url );
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
+    input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
     input_item_AddSubItem( p_current_input, p_input );
     vlc_gc_decref( p_input );
 
     vlc_gc_decref(p_current_input);
+    free( psz_url );
 
     return 0; /* Needed for correct operation of go back */
 }




More information about the vlc-devel mailing list