changeset 4096:e06261511a5d

Fix memory leaks when generating UI strings in ui_main.c (Bugzilla #18)
author Jussi Judin <jjudin+audacious@iki.fi>
date Wed, 19 Dec 2007 00:45:41 -0600
parents 7e57ace6385a
children 96194518173c
files src/audacious/ui_main.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Wed Dec 19 00:42:50 2007 -0600
+++ b/src/audacious/ui_main.c	Wed Dec 19 00:45:41 2007 -0600
@@ -496,6 +496,7 @@
 {
     gchar *mainwin_title_text = make_mainwin_title(title);
     gtk_window_set_title(GTK_WINDOW(mainwin), mainwin_title_text);
+    g_free(mainwin_title_text);
 }
 
 static void
@@ -727,13 +728,13 @@
         if (bitrate < 1000) {
             /* Show bitrate in 1000s */
             text = g_strdup_printf("%3d", bitrate);
-            ui_skinned_textbox_set_text(mainwin_rate_text, text);
         }
         else {
             /* Show bitrate in 100,000s */
             text = g_strdup_printf("%2dH", bitrate / 100);
-            ui_skinned_textbox_set_text(mainwin_rate_text, text);
         }
+        ui_skinned_textbox_set_text(mainwin_rate_text, text);
+        g_free(text);
     }
     else
         ui_skinned_textbox_set_text(mainwin_rate_text, _("VBR"));
@@ -741,6 +742,7 @@
     /* Show sampling frequency in kHz */
     text = g_strdup_printf("%2d", frequency / 1000);
     ui_skinned_textbox_set_text(mainwin_freq_text, text);
+    g_free(text);
 
     ui_skinned_monostereo_set_num_channels(mainwin_monostereo, n_channels);
 
@@ -760,6 +762,7 @@
             (n_channels > 1) ? _("stereo") : _("mono"));
 
         ui_skinned_textbox_set_text(mainwin_othertext, text);
+        g_free(text);
     }
 
     title = playlist_get_info_text(playlist);