From: Matthew Jordan Date: Wed, 30 Jan 2013 14:15:27 +0000 (+0000) Subject: Fix memory leak in res_calendar_icalendar X-Git-Tag: 11.3.0-rc1~3^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a458061b162780cba638ce224a7ba674f151115;p=thirdparty%2Fasterisk.git 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 ........ Merged revisions 380451 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@380452 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_calendar_icalendar.c b/res/res_calendar_icalendar.c index dc7b5f31cd..3aea7a4639 100644 --- a/res/res_calendar_icalendar.c +++ b/res/res_calendar_icalendar.c @@ -468,6 +468,11 @@ static void *ical_load_calendar(void *void_data) 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;