[asterisk-commits] res calendar: Plug memory leak and micro-optimization (asterisk[15])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 20 06:59:04 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6509 )

Change subject: res_calendar: Plug memory leak and micro-optimization
......................................................................

res_calendar: Plug memory leak and micro-optimization

ast_variables_destroy is NULL safe, so there is no need to check its
argument before passing it.

ASTERISK-25524 #close
Reported by: Jesper

Change-Id: Ib0f8057642e9d471960f1a79fd42e5a3ce587d3b
---
M res/res_calendar.c
M res/res_calendar_caldav.c
2 files changed, 2 insertions(+), 4 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_calendar.c b/res/res_calendar.c
index bf385db..3369f38 100644
--- a/res/res_calendar.c
+++ b/res/res_calendar.c
@@ -339,10 +339,7 @@
 	}
 	ast_calendar_clear_events(cal);
 	ast_string_field_free_memory(cal);
-	if (cal->vars) {
-		ast_variables_destroy(cal->vars);
-		cal->vars = NULL;
-	}
+	ast_variables_destroy(cal->vars);
 	ao2_ref(cal->events, -1);
 	ao2_unlock(cal);
 }
diff --git a/res/res_calendar_caldav.c b/res/res_calendar_caldav.c
index b6822b0..248c80e 100644
--- a/res/res_calendar_caldav.c
+++ b/res/res_calendar_caldav.c
@@ -78,6 +78,7 @@
 	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);

-- 
To view, visit https://gerrit.asterisk.org/6509
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0f8057642e9d471960f1a79fd42e5a3ce587d3b
Gerrit-Change-Number: 6509
Gerrit-PatchSet: 3
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170920/b62733a6/attachment-0001.html>


More information about the asterisk-commits mailing list