[asterisk-commits] mjordan: branch 1.8 r380451 - /branches/1.8/res/res_calendar_icalendar.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 30 08:12:23 CST 2013


Author: mjordan
Date: Wed Jan 30 08:12:19 2013
New Revision: 380451

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380451
Log:
Fix memory leak in res_calendar_icalendar

The ICalendar module had a systemic memory leak on each fetch of data from
the ICalendar source. The previous fetched data was not being properly
disposed. This patch makes it so that before each fetch of data, we dispose
of the previously fetched data.

(closes issue ASTERISK-21012)
Reported by: Joel Vandal
Tested by: Joel Vandal


Modified:
    branches/1.8/res/res_calendar_icalendar.c

Modified: branches/1.8/res/res_calendar_icalendar.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_calendar_icalendar.c?view=diff&rev=380451&r1=380450&r2=380451
==============================================================================
--- branches/1.8/res/res_calendar_icalendar.c (original)
+++ branches/1.8/res/res_calendar_icalendar.c Wed Jan 30 08:12:19 2013
@@ -468,6 +468,11 @@
 
 		ast_debug(10, "Refreshing after %d minute timeout\n", pvt->owner->refresh);
 
+		/* Free the old calendar data */
+		if (pvt->data) {
+			icalcomponent_free(pvt->data);
+			pvt->data = NULL;
+		}
 		if (!(pvt->data = fetch_icalendar(pvt))) {
 			ast_log(LOG_WARNING, "Unable to parse iCalendar '%s'\n", pvt->owner->name);
 			continue;




More information about the asterisk-commits mailing list