changeset 4870:56af01cd5a5c

Eliminate a double free (bug #30)
author John Lindgren <john.lindgren@tds.net>
date Sat, 25 Apr 2009 21:32:54 -0400
parents f07844bdc43f
children 985cd1e770df
files src/audlegacy/dbus.c
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/audlegacy/dbus.c	Fri Apr 24 09:43:41 2009 +0100
+++ b/src/audlegacy/dbus.c	Sat Apr 25 21:32:54 2009 -0400
@@ -89,10 +89,10 @@
     guint request_ret;
 
     g_message("Registering remote D-Bus interfaces");
-    
+
     dbus_g_object_type_install_info(audacious_rc_get_type(),
                                     &dbus_glib_audacious_rc_object_info);
-    
+
     // Register DBUS path
     dbus_g_connection_register_g_object(dbus_conn,
                                         AUDACIOUS_DBUS_PATH, G_OBJECT(object));
@@ -121,7 +121,7 @@
 void mpris_root_init(MprisRoot *object) {
     dbus_g_object_type_install_info(mpris_root_get_type(),
                                     &dbus_glib_mpris_root_object_info);
-    
+
     // Register DBUS path
     dbus_g_connection_register_g_object(dbus_conn,
                                         AUDACIOUS_DBUS_PATH_MPRIS_ROOT,
@@ -131,7 +131,7 @@
 void mpris_player_init(MprisPlayer *object) {
     dbus_g_object_type_install_info(mpris_player_get_type(),
                                     &dbus_glib_mpris_player_object_info);
-    
+
     // Register DBUS path
     dbus_g_connection_register_g_object(dbus_conn,
                                         AUDACIOUS_DBUS_PATH_MPRIS_PLAYER,
@@ -155,7 +155,7 @@
 void mpris_tracklist_init(MprisTrackList *object) {
     dbus_g_object_type_install_info(mpris_tracklist_get_type(),
                                     &dbus_glib_mpris_tracklist_object_info);
-    
+
     // Register DBUS path
     dbus_g_connection_register_g_object(dbus_conn,
                                         AUDACIOUS_DBUS_PATH_MPRIS_TRACKLIST,
@@ -244,7 +244,7 @@
     value = tuple_value_to_gvalue(tuple, "track-number");
     if (value != NULL)
     {
-        g_hash_table_insert(md, "tracknumber", value); 
+        g_hash_table_insert(md, "tracknumber", value);
     }
 
     return md;
@@ -562,7 +562,7 @@
         res[i] = g_strdup(tuple_fields[i].name);
     }
     *fields = res;
-    
+
     return TRUE;
 }
 
@@ -912,10 +912,7 @@
     gchar *pl_name = NULL;
 
     pl_name = (gchar*)playlist_get_current_name(new_pl);
-    if(!pl_name)
-        pl_name = g_strdup("New Playlist");
-    playlist_set_current_name(new_pl, pl_name);
-    g_free(pl_name);
+    playlist_set_current_name (new_pl, pl_name ? pl_name : "New Playlist");
 
     playlist_add_playlist(new_pl);
 
@@ -928,7 +925,7 @@
     return TRUE;
 }
 
-/* New on Nov 7: Equalizer */ 
+/* New on Nov 7: Equalizer */
 gboolean audacious_rc_get_eq(RemoteObject *obj, gdouble *preamp, GArray **bands, GError **error)
 {
     int i;
@@ -960,7 +957,7 @@
 {
     gdouble element;
     int i;
-    
+
     equalizer_set_preamp((gfloat)preamp);
 
     for (i = 0; i < AUD_EQUALIZER_NBANDS; i++) {