[vlc-devel] commit: vcdx: Fix memleaks. ( Rémi Duraffort )

git version control git at videolan.org
Fri Aug 1 15:46:43 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Aug  1 12:34:24 2008 +0200| [31a163942d6682ae31679e6e2be898f9314b2cc0] | committer: Rémi Duraffort 

vcdx: Fix memleaks.

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

 modules/access/vcdx/access.c |    1 +
 modules/access/vcdx/info.c   |   23 ++++++++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/modules/access/vcdx/access.c b/modules/access/vcdx/access.c
index a4fc5bb..279c34a 100644
--- a/modules/access/vcdx/access.c
+++ b/modules/access/vcdx/access.c
@@ -651,6 +651,7 @@ VCDParse( access_t * p_access, /*out*/ vcdinfo_itemid_t * p_itemid,
       psz_source = config_GetPsz( p_access, "vcd" );
 
       if( !psz_source || 0==strlen(psz_source) ) {
+        free( psz_source );
         /* Scan for a CD-ROM drive with a VCD in it. */
         char **cd_drives = cdio_get_devices_with_cap( NULL,
                             ( CDIO_FS_ANAL_SVCD | CDIO_FS_ANAL_CVD
diff --git a/modules/access/vcdx/info.c b/modules/access/vcdx/info.c
index 79ef1f2..dc0ec98 100644
--- a/modules/access/vcdx/info.c
+++ b/modules/access/vcdx/info.c
@@ -175,10 +175,11 @@ VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
 
   if ( CDIO_INVALID_TRACK != i_track )
   {
+    char* psz_title_format = config_GetPsz( p_access, MODULE_STRING "-title-format" );
     char *psz_name =
-      VCDFormatStr( p_access, p_vcdplayer,
-            config_GetPsz( p_access, MODULE_STRING "-title-format" ),
-            psz_mrl, &(p_vcdplayer->play_item) );
+      VCDFormatStr( p_access, p_vcdplayer, psz_title_format, psz_mrl,
+                    &(p_vcdplayer->play_item) );
+    free( psz_title_format );
  
     input_Control( p_vcdplayer->p_input, INPUT_SET_NAME, psz_name );
   }
@@ -385,14 +386,14 @@ VCDUpdateTitle( access_t *p_access )
     if( psz_mrl )
     {
         char *psz_name;
-    snprintf(psz_mrl, psz_mrl_max, "%s%s",
-         VCD_MRL_PREFIX, p_vcdplayer->psz_source);
-    psz_name = VCDFormatStr( p_access, p_vcdplayer,
-                 config_GetPsz( p_access, MODULE_STRING
-                        "-title-format" ),
-                psz_mrl, &(p_vcdplayer->play_item) );
-    input_Control( p_vcdplayer->p_input, INPUT_SET_NAME, psz_name );
-    free(psz_mrl);
+        char* psz_title_format = config_GetPsz( p_access, MODULE_STRING "-title-format" )
+        snprintf( psz_mrl, psz_mrl_max, "%s%s",
+                  VCD_MRL_PREFIX, p_vcdplayer->psz_source );
+        psz_name = VCDFormatStr( p_access, p_vcdplayer, psz_title_format, psz_mrl,
+                                 &(p_vcdplayer->play_item) );
+        input_Control( p_vcdplayer->p_input, INPUT_SET_NAME, psz_name );
+        free( psz_title_format );
+        free(psz_mrl);
     }
 }
 




More information about the vlc-devel mailing list