← Back to team overview

lightdm-gtk-greeter-team team mailing list archive

[Merge] lp:~a-j-buxton/lightdm-gtk-greeter/clockleak into lp:lightdm-gtk-greeter

 

Alistair Buxton has proposed merging lp:~a-j-buxton/lightdm-gtk-greeter/clockleak into lp:lightdm-gtk-greeter.

Commit message:
Fix a memory leak in the clock timeout function.

Requested reviews:
  LightDM Gtk+ Greeter Development Team (lightdm-gtk-greeter-team)

For more details, see:
https://code.launchpad.net/~a-j-buxton/lightdm-gtk-greeter/clockleak/+merge/201074

The clock timeout function updates the label with the current time. The temporary string used to hold the time and markup should be freed after setting the label.

Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734526
-- 
https://code.launchpad.net/~a-j-buxton/lightdm-gtk-greeter/clockleak/+merge/201074
Your team LightDM Gtk+ Greeter Development Team is requested to review the proposed merge of lp:~a-j-buxton/lightdm-gtk-greeter/clockleak into lp:lightdm-gtk-greeter.
=== modified file 'src/lightdm-gtk-greeter.c'
--- src/lightdm-gtk-greeter.c	2014-01-09 02:35:27 +0000
+++ src/lightdm-gtk-greeter.c	2014-01-09 18:47:46 +0000
@@ -1732,12 +1732,15 @@
     time_t rawtime;
     struct tm * timeinfo;
     gchar time_str[50];
+    gchar *markup;
     
     time ( &rawtime );
     timeinfo = localtime ( &rawtime );
     
     strftime(time_str, 50, clock_format, timeinfo);
-    gtk_label_set_markup( GTK_LABEL(clock_label), g_strdup_printf("<b>%s</b>", time_str) );
+    markup = g_markup_printf_escaped("<b>%s</b>", time_str);
+    gtk_label_set_markup( GTK_LABEL(clock_label), markup );
+    g_free(markup);
     
     return TRUE;
 }


Follow ups