]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix memory leak in res_calendar_icalendar
authorMatthew Jordan <mjordan@digium.com>
Wed, 30 Jan 2013 14:12:19 +0000 (14:12 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 30 Jan 2013 14:12:19 +0000 (14:12 +0000)
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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@380451 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_calendar_icalendar.c

index a2fcaa000e4045a969db220500003732fed9172d..7ee22f5c749e9f21847d17e6810f5882b60a9181 100644 (file)
@@ -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;