[Xfce4-commits] <xfce4-weather-plugin:master> Fix possible crash in xml_weather_free().
Harald Judt
noreply at xfce.org
Sun Dec 9 23:44:10 CET 2012
Updating branch refs/heads/master
to 4cafe32a4c565414ae88b27894f821788f3ac7a6 (commit)
from b500f916eca04815f9eb0ac21da3bc1745375edb (commit)
commit 4cafe32a4c565414ae88b27894f821788f3ac7a6
Author: Harald Judt <h.judt at gmx.at>
Date: Sun Dec 9 19:24:21 2012 +0100
Fix possible crash in xml_weather_free().
panel-plugin/weather-parsers.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index fab795d..08ef607 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -588,12 +588,14 @@ xml_weather_free(xml_weather *wd)
g_assert(wd != NULL);
if (G_UNLIKELY(wd == NULL))
return;
- weather_debug("Freeing %u timeslices.", wd->timeslices->len);
- for (i = 0; i < wd->timeslices->len; i++) {
- timeslice = g_array_index(wd->timeslices, xml_time*, i);
- xml_time_free(timeslice);
+ if (G_LIKELY(wd->timeslices)) {
+ weather_debug("Freeing %u timeslices.", wd->timeslices->len);
+ for (i = 0; i < wd->timeslices->len; i++) {
+ timeslice = g_array_index(wd->timeslices, xml_time*, i);
+ xml_time_free(timeslice);
+ }
+ g_array_free(wd->timeslices, FALSE);
}
- g_array_free(wd->timeslices, FALSE);
if (G_LIKELY(wd->current_conditions)) {
weather_debug("Freeing current conditions.");
xml_time_free(wd->current_conditions);
More information about the Xfce4-commits
mailing list