summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-05-30 21:22:00 -0400
committerCorey Farrell <git@cfware.com>2015-06-01 03:07:56 -0500
commit9e7827e3ac057f22bc17823a44778b76270c5901 (patch)
treec0bfe6634ec2303e0326e444ff96f7254303fd2c /res/res_pjsip
parent857166b5e5dbdb81b4c25a42f36842a394989768 (diff)
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
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/pjsip_configuration.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index a1c75e2a9..34bb69211 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -103,8 +103,7 @@ static int persistent_endpoint_update_state(void *obj, void *arg, void *data, in
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);