[asterisk-commits] res pjsip endpoint identifier ip: Fix memory leak of hosts w... (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 27 07:02:15 CST 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/4831 )

Change subject: res_pjsip_endpoint_identifier_ip: Fix memory leak of hosts when resolving.
......................................................................


res_pjsip_endpoint_identifier_ip: Fix memory leak of hosts when resolving.

This change adds a missing unreference of the hostname when resolving and
also cleans up the iterator.

ASTERISK-26735

Change-Id: Ic012ebaf3d89e714eec340b7b0c5e63c66af857a
---
M res/res_pjsip_endpoint_identifier_ip.c
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Verified
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/res/res_pjsip_endpoint_identifier_ip.c b/res/res_pjsip_endpoint_identifier_ip.c
index 116e2d8..86a5afb 100644
--- a/res/res_pjsip_endpoint_identifier_ip.c
+++ b/res/res_pjsip_endpoint_identifier_ip.c
@@ -323,9 +323,14 @@
 		} else if (results == -1) {
 			ast_log(LOG_ERROR, "An error occurred when adding resolution results of '%s' on '%s'\n",
 				current_string, ast_sorcery_object_get_id(obj));
+			ao2_ref(current_string, -1);
+			ao2_iterator_destroy(&i);
 			return -1;
 		}
+
+		ao2_ref(current_string, -1);
 	}
+	ao2_iterator_destroy(&i);
 
 	ao2_ref(identify->hosts, -1);
 	identify->hosts = NULL;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic012ebaf3d89e714eec340b7b0c5e63c66af857a
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list