[vlc-devel] commit: xspf: cosmetics and fix potential memleak. ( Rémi Duraffort )

git version control git at videolan.org
Sat Aug 29 10:18:45 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Aug 29 10:17:30 2009 +0200| [a67c13305e85f45624061e5e02458d4fdb5a9f0d] | committer: Rémi Duraffort 

xspf: cosmetics and fix potential memleak.

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

 modules/demux/playlist/xspf.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 9594c9d..4a62a51 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -63,15 +63,15 @@ int Import_xspf( vlc_object_t *p_this )
 void Close_xspf( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
-    int i;
-    for(i = 0; i < p_demux->p_sys->i_tracklist_entries; i++)
+    demux_sys_t *p_sys = p_demux->p_sys;
+    for( int i = 0; i < p_sys->i_tracklist_entries; i++ )
     {
-        if(p_demux->p_sys->pp_tracklist[i])
-            vlc_gc_decref( p_demux->p_sys->pp_tracklist[i] );
+        if( p_sys->pp_tracklist[i] )
+            vlc_gc_decref( p_sys->pp_tracklist[i] );
     }
-    free( p_demux->p_sys->pp_tracklist );
-    free( p_demux->p_sys->psz_base );
-    free( p_demux->p_sys );
+    free( p_sys->pp_tracklist );
+    free( p_sys->psz_base );
+    free( p_sys );
 }
 
 /**
@@ -113,6 +113,7 @@ int Demux( demux_t *p_demux )
     if( !psz_name || strcmp( psz_name, "playlist" ) )
     {
         msg_Err( p_demux, "invalid root node name: %s", psz_name );
+        free( psz_name );
         goto end;
     }
     free( psz_name );




More information about the vlc-devel mailing list