diff options
author | George Joseph <george.joseph@fairview5.com> | 2015-05-29 15:19:26 -0600 |
---|---|---|
committer | George Joseph <george.joseph@fairview5.com> | 2015-05-29 16:34:27 -0500 |
commit | bef000dd7c58485b340486a10477a84fff547e3f (patch) | |
tree | fe1db251fd8d1c995674d0f6e9e5a0a4589ff32f /res/res_pjsip/location.c | |
parent | 3fc4a58d75ba328c95f2f056d83a44edd2c2848f (diff) |
res_pjsip/location: Fix memory leak in permanent_uri_handler
When permanent_uri_handler was creating the contact status
object for each contact, it wasn't unreffing it at the
end of the loop.
ASTERISK-25141 #close
Reported-by: Corey Farrell
Change-Id: I7bb127994677bb3d459f87952f8425c9b9967b12
Diffstat (limited to 'res/res_pjsip/location.c')
-rw-r--r-- | res/res_pjsip/location.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 887053b07..9e75929d7 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -354,6 +354,7 @@ static int permanent_uri_handler(const struct aco_option *opt, struct ast_variab contacts = ast_strdupa(var->value); while ((contact_uri = strsep(&contacts, ","))) { struct ast_sip_contact *contact; + struct ast_sip_contact_status *status; char contact_id[strlen(aor_id) + strlen(contact_uri) + 2 + 1]; if (ast_sip_push_task_synchronous(NULL, permanent_contact_validate, contact_uri)) { @@ -376,10 +377,12 @@ static int permanent_uri_handler(const struct aco_option *opt, struct ast_variab return -1; } - if (!ast_res_pjsip_find_or_create_contact_status(contact)) { + status = ast_res_pjsip_find_or_create_contact_status(contact); + if (!status) { ao2_ref(contact, -1); return -1; } + ao2_ref(status, -1); ast_string_field_set(contact, uri, contact_uri); ao2_link(aor->permanent_contacts, contact); |