[asterisk-commits] pjsip configuration: Fix leak in persistent endpoint update ... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 1 10:46:42 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: pjsip_configuration: Fix leak in persistent_endpoint_update_state.
......................................................................


pjsip_configuration: Fix leak in persistent_endpoint_update_state.

The loop to find the first available contact of an endpoint grabbed
contact from the iterator, then checked for offline state.  This
caused the first contact after the state was found to leak a reference.

ASTERISK-25141

Change-Id: Id0f1d87410fc63742db0594eb4b18b36e99aec08
---
M res/res_pjsip/pjsip_configuration.c
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified
  George Joseph: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 59598ec..4ce7735 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -103,8 +103,7 @@
 	contacts = ast_sip_location_retrieve_contacts_from_aor_list(persistent->aors);
 	if (contacts) {
 		i = ao2_iterator_init(contacts, 0);
-		while ((contact = ao2_iterator_next(&i))
-			&& state == AST_ENDPOINT_OFFLINE) {
+		while (state == AST_ENDPOINT_OFFLINE && (contact = ao2_iterator_next(&i))) {
 			struct ast_sip_contact_status *contact_status;
 			const char *contact_id = ast_sorcery_object_get_id(contact);
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id0f1d87410fc63742db0594eb4b18b36e99aec08
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list