From 2a97f6029b467702a362d0b1b7108717366d903e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Sep 2013 21:55:23 -0500 Subject: Don't unref NULLs --- src/service.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index fec2bb1..421e3dd 100644 --- a/src/service.c +++ b/src/service.c @@ -577,9 +577,9 @@ get_all_appointments_this_month (IndicatorDatetimeService * self) if (p->planner != NULL) { - GDateTime * calendar_date; - GDateTime * begin; - GDateTime * end; + GDateTime * calendar_date = NULL; + GDateTime * begin = NULL; + GDateTime * end = NULL; int y, m, d; calendar_date = get_calendar_date (self); @@ -593,9 +593,12 @@ get_all_appointments_this_month (IndicatorDatetimeService * self) begin, end); - g_date_time_unref (end); - g_date_time_unref (begin); - g_date_time_unref (calendar_date); + if (end != NULL) + g_date_time_unref (end); + if (begin != NULL) + g_date_time_unref (begin); + if (calendar_date != NULL) + g_date_time_unref (calendar_date); } return appointments; -- cgit v1.2.3