diff options
author | Corey Farrell <git@cfware.com> | 2015-05-30 21:22:00 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2015-06-01 03:08:50 -0500 |
commit | 9f1939ee2730c90b5cd2f43d8e0bc3780addb606 (patch) | |
tree | 21b43b01a9704163b8b76aab78569575db8a1fb7 | |
parent | bef000dd7c58485b340486a10477a84fff547e3f (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
-rw-r--r-- | res/res_pjsip/pjsip_configuration.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 59598ecdf..4ce773563 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); |