[vlc-devel] commit: cdda/info: 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:30:27 2008 +0200| [75a1834d394b6a89a6ead139d57c097704d3943a] | committer: Rémi Duraffort 

cdda/info: fix memleaks.

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

 modules/access/cdda/info.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/access/cdda/info.c b/modules/access/cdda/info.c
index 4f84927..0286446 100644
--- a/modules/access/cdda/info.c
+++ b/modules/access/cdda/info.c
@@ -73,15 +73,15 @@ GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda )
         goto cddb_destroy;
     }
 
-    cddb_set_email_address( conn,
-                            config_GetPsz( p_access,
-                                           MODULE_STRING "-cddb-email") );
-    cddb_set_server_name( conn,
-                          config_GetPsz( p_access,
-                                         MODULE_STRING "-cddb-server") );
+    char* psz_email = config_GetPsz( p_access, MODULE_STRING "-cddb-email");
+    char* psz_srv_name = config_GetPsz( p_access, MODULE_STRING "-cddb-server");
+    cddb_set_email_address( conn, psz_email );
+    cddb_set_server_name( conn, psz_srv_name );
     cddb_set_server_port(conn,
                          config_GetInt( p_access,
                                         MODULE_STRING "-cddb-port") );
+    free( psz_email );
+    free( psz_srv_name );
 
   /* Set the location of the local CDDB cache directory.
      The default location of this directory is */
@@ -89,9 +89,9 @@ GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda )
     if (!config_GetInt( p_access, MODULE_STRING "-cddb-enable-cache" ))
         cddb_cache_disable(conn);
 
-    cddb_cache_set_dir(conn,
-                     config_GetPsz( p_access,
-                                    MODULE_STRING "-cddb-cachedir") );
+    char* psz_cache = config_GetPsz( p_access, MODULE_STRING "-cddb-cachedir");
+    cddb_cache_set_dir(conn, psz_cache );
+    free( psz_cache );
 
     cddb_set_timeout(conn,
                    config_GetInt( p_access, MODULE_STRING "-cddb-timeout") );
@@ -797,14 +797,14 @@ CDDAFormatTitle( const access_t *p_access, track_t i_track )
             config_varname = MODULE_STRING "-cddb-title-format";
         }
 #endif /*HAVE_LIBCDDB*/
-        psz_name =
-            CDDAFormatStr( p_access, p_cdda,
-                config_GetPsz( p_access, config_varname ),
-                psz_mrl, i_track );
-        free(psz_mrl);
+        char* psz_config_varname = config_GetPsz( p_access, config_varname );
+        psz_name = CDDAFormatStr( p_access, p_cdda, psz_config_varname,
+                                  psz_mrl, i_track );
+        free( psz_config_varname );
+        free( psz_mrl );
         return psz_name;
     }
-    return(NULL);
+    return NULL;
 }
 
 static playlist_item_t *




More information about the vlc-devel mailing list