Commit 3293bacf authored by Harald Judt's avatar Harald Judt

Fix a bunch of memory leaks.

Fix some memory leaks related to translations in summary and
to the creation of current conditions.
parent 7c8fbaeb
......@@ -404,7 +404,7 @@ make_forecast (xfceweather_data *data)
GdkColor lightbg = {0, 0xeaea, 0xeaea, 0xeaea};
GdkColor darkbg = {0, 0x6666, 0x6666, 0x6666};
gint i, weekday, daytime;
gchar *dayname, *wind_speed, *value, *rawvalue;
gchar *dayname, *wind_speed, *wind_direction, *value, *rawvalue;
xml_time *fcdata;
time_t now_t = time(NULL), fcday_t;
struct tm fcday_tm;
......@@ -439,13 +439,14 @@ make_forecast (xfceweather_data *data)
fcday_t = time_calc_day(fcday_tm, i);
weekday = localtime(&fcday_t)->tm_wday;
if (i == 0)
dayname = _("Today");
dayname = g_strdup_printf(_("Today"));
else if (i == 1)
dayname = _("Tomorrow");
dayname = g_strdup_printf(_("Tomorrow"));
else
dayname = translate_day(weekday);
ebox = add_forecast_header(dayname, 90.0, &darkbg);
g_free(dayname);
gtk_table_attach_defaults(GTK_TABLE(table), GTK_WIDGET(ebox),
0, 1, i+1, i+2);
......@@ -495,12 +496,14 @@ make_forecast (xfceweather_data *data)
g_free(value);
rawvalue = get_data(fcdata, data->unit_system, WIND_DIRECTION);
wind_direction = translate_wind_direction(rawvalue);
wind_speed = get_data(fcdata, data->unit_system, WIND_SPEED);
value = g_strdup_printf("%s %s %s",
translate_wind_direction(rawvalue),
wind_direction,
wind_speed,
get_unit(fcdata, data->unit_system, WIND_SPEED));
g_free(wind_speed);
g_free(wind_direction);
g_free(rawvalue);
label = gtk_label_new(value);
gtk_box_pack_start(GTK_BOX(forecast_box), label, TRUE, TRUE, 0);
......
......@@ -457,6 +457,9 @@ update_weatherdata (xfceweather_data *data)
/* update current conditions, icon and labels */
if (data->weatherdata)
{
if (data->weatherdata->current_conditions)
xml_time_free(data->weatherdata->current_conditions);
data->weatherdata->current_conditions = make_current_conditions(data->weatherdata);
data->last_conditions_update = time(NULL);
set_icon_current (data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment