[vlc-devel] commit: SD_mediadirs: no need to strdup. ( Rémi Duraffort )

git version control git at videolan.org
Sat Oct 10 11:57:43 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Sep 22 22:43:51 2009 +0200| [f0ef42132167a1bc7a020a0b7158d5868be95768] | committer: Rémi Duraffort 

SD_mediadirs: no need to strdup.

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

 modules/services_discovery/mediadirs.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c
index 425beb5..bfecfd7 100644
--- a/modules/services_discovery/mediadirs.c
+++ b/modules/services_discovery/mediadirs.c
@@ -107,7 +107,7 @@ struct services_discovery_sys_t
     enum type_e i_type;
 
     char* psz_dir[2];
-    char* psz_var;
+    const char* psz_var;
 };
 
 /*****************************************************************************
@@ -129,21 +129,21 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
         p_sys->psz_dir[0] = config_GetUserDir( VLC_VIDEOS_DIR );
         p_sys->psz_dir[1] = var_CreateGetString( p_sd, "input-record-path" );
 
-        p_sys->psz_var = strdup( "record-file" );
+        p_sys->psz_var = "record-file";
     }
     else if( p_sys->i_type == Audio )
     {
         p_sys->psz_dir[0] = config_GetUserDir( VLC_MUSIC_DIR );
         p_sys->psz_dir[1] = var_CreateGetString( p_sd, "input-record-path" );
 
-        p_sys->psz_var = strdup( "record-file" );
+        p_sys->psz_var = "record-file";
     }
     else if( p_sys->i_type == Picture )
     {
         p_sys->psz_dir[0] = config_GetUserDir( VLC_PICTURES_DIR );
         p_sys->psz_dir[1] = var_CreateGetString( p_sd, "snapshot-path" );
 
-        p_sys->psz_var = strdup( "snapshot-file" );
+        p_sys->psz_var = "snapshot-file";
     }
     else
     {
@@ -156,7 +156,6 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
     if( vlc_clone( &p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW ) )
     {
         var_DelCallback( p_sd->p_libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
-        free( p_sys->psz_var );
         free( p_sys->psz_dir[1] );
         free( p_sys->psz_dir[0] );
         free( p_sys );
@@ -233,7 +232,6 @@ static void Close( vlc_object_t *p_this )
 
     var_DelCallback( p_sd->p_libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
 
-    free( p_sys->psz_var );
     free( p_sys->psz_dir[1] );
     free( p_sys->psz_dir[0] );
     free( p_sys );




More information about the vlc-devel mailing list