[Goodies-commits] r4714 - in xfce4-datetime-plugin/trunk: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Fri May 2 21:48:37 CEST 2008
Author: ongardie
Date: 2008-05-02 19:48:37 +0000 (Fri, 02 May 2008)
New Revision: 4714
Modified:
xfce4-datetime-plugin/trunk/ChangeLog
xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
Log:
Fix memory leak with double-g_strdup of setting strings
Modified: xfce4-datetime-plugin/trunk/ChangeLog
===================================================================
--- xfce4-datetime-plugin/trunk/ChangeLog 2008-05-02 19:48:28 UTC (rev 4713)
+++ xfce4-datetime-plugin/trunk/ChangeLog 2008-05-02 19:48:37 UTC (rev 4714)
@@ -1,5 +1,7 @@
2008-05-02 Diego Ongaro <ongardie at gmail.com>
- * panel-plugin/datetime.c: handle NULL from xfce_rc_simple_open
+ * panel-plugin/datetime.c:
+ - fix memory leak with double-g_strdup of setting strings
+ - handle NULL from xfce_rc_simple_open,
* panel-plugin/datetime.h: Use GtkTooltips type (fixes build)
2007-04-07 Remco den Breeje <remco at sx.mine.nu>
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime.c 2008-05-02 19:48:28 UTC (rev 4713)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime.c 2008-05-02 19:48:37 UTC (rev 4714)
@@ -484,14 +484,13 @@
XfceRc *rc;
t_layout layout;
const gchar *date_font, *time_font, *date_format, *time_format;
- const gchar *val;
/* load defaults */
layout = LAYOUT_DATE_TIME;
- date_font = g_strdup("Bitstream Vera Sans 8");
- time_font = g_strdup("Bitstream Vera Sans 10");
- date_format = g_strdup("%Y/%m/%d");
- time_format = g_strdup("%H:%M");
+ date_font = "Bitstream Vera Sans 8";
+ time_font = "Bitstream Vera Sans 10";
+ date_format = "%Y/%m/%d";
+ time_format = "%H:%M";
/* open file */
if((file = xfce_panel_plugin_lookup_rc_file(plugin)) != NULL)
@@ -502,19 +501,20 @@
if(rc != NULL)
{
layout = xfce_rc_read_int_entry(rc, "layout", layout);
- val = xfce_rc_read_entry(rc, "date_font", date_font);
- date_font = g_strdup(val);
- val = xfce_rc_read_entry(rc, "time_font", time_font);
- time_font = g_strdup(val);
- val = xfce_rc_read_entry(rc, "date_format", date_format);
- date_format = g_strdup(val);
- val = xfce_rc_read_entry(rc, "time_format", time_format);
- time_format = g_strdup(val);
+ date_font = xfce_rc_read_entry(rc, "date_font", date_font);
+ time_font = xfce_rc_read_entry(rc, "time_font", time_font);
+ date_format = xfce_rc_read_entry(rc, "date_format", date_format);
+ time_format = xfce_rc_read_entry(rc, "time_format", time_format);
xfce_rc_close(rc);
}
}
+ date_font = g_strdup(date_font);
+ time_font = g_strdup(time_font);
+ date_format = g_strdup(date_format);
+ time_format = g_strdup(time_format);
+
/* set values in dt struct */
datetime_apply_layout(dt, layout);
datetime_apply_font(dt, date_font, time_font);
More information about the Goodies-commits
mailing list