From: Joshua Colp Date: Thu, 26 Jan 2017 13:57:59 +0000 (+0000) Subject: res_pjsip_endpoint_identifier_ip: Fix memory leak of hosts when resolving. X-Git-Tag: 13.14.0-rc1~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aae9df06433512f58701daf66ae99c292d6c9908;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_endpoint_identifier_ip.c b/res/res_pjsip_endpoint_identifier_ip.c index c16e84a672..6fc724a1ea 100644 --- a/res/res_pjsip_endpoint_identifier_ip.c +++ b/res/res_pjsip_endpoint_identifier_ip.c @@ -323,9 +323,14 @@ static int ip_identify_apply(const struct ast_sorcery *sorcery, void *obj) } 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;