res_calendar: Resolve memory leak on calendar destruction
authorSean Bright <sean.bright@gmail.com>
Thu, 24 Oct 2019 14:15:14 +0000 (10:15 -0400)
committerSean Bright <sean.bright@gmail.com>
Thu, 24 Oct 2019 14:18:38 +0000 (09:18 -0500)
Calling ne_uri_parse allocates memory that needs to be freed with a
corresponding call to ne_uri_free.

ASTERISK-28572 #close

Change-Id: I8a6834da27000a6807d89cb7a157b2a88fcb5e61

res/res_calendar_ews.c
res/res_calendar_exchange.c
res/res_calendar_icalendar.c

index c12fb01..e4d250c 100644 (file)
@@ -118,6 +118,7 @@ static void ewscal_destructor(void *obj)
        if (pvt->session) {
                ne_session_destroy(pvt->session);
        }
+       ne_uri_free(&pvt->uri);
        ast_string_field_free_memory(pvt);
 
        ao2_callback(pvt->events, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);
index 21c1c1a..6d624c1 100644 (file)
@@ -224,6 +224,7 @@ static void exchangecal_destructor(void *obj)
        if (pvt->session) {
                ne_session_destroy(pvt->session);
        }
+       ne_uri_free(&pvt->uri);
        ast_string_field_free_memory(pvt);
 
        ao2_callback(pvt->events, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);
index 4f78f9a..debb55c 100644 (file)
@@ -78,6 +78,7 @@ static void icalendar_destructor(void *obj)
        if (pvt->data) {
                icalcomponent_free(pvt->data);
        }
+       ne_uri_free(&pvt->uri);
        ast_string_field_free_memory(pvt);
 
        ao2_callback(pvt->events, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);