diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c index c0326fb..f44c4af 100644 --- a/panel-plugin/weather-parsers.c +++ b/panel-plugin/weather-parsers.c @@ -239,6 +239,8 @@ void parse_location (xmlNode * cur_node, xml_location *loc) static void xml_location_free(xml_location *loc) { + if (loc == NULL) + return; g_free(loc->altitude); g_free(loc->latitude); g_free(loc->longitude); @@ -261,12 +263,16 @@ static void xml_location_free(xml_location *loc) g_free(loc->precipitation_unit); g_free(loc->symbol); g_slice_free (xml_location, loc); + loc = NULL; } void xml_time_free(xml_time *timeslice) { + if (timeslice == NULL) + return; xml_location_free(timeslice->location); g_slice_free (xml_time, timeslice); + timeslice = NULL; } void xml_weather_free (xml_weather *data) @@ -278,4 +284,5 @@ void xml_weather_free (xml_weather *data) } xml_time_free(data->current_conditions); g_slice_free (xml_weather, data); + data = NULL; }