diff options
author | zuul <zuul@gerrit.asterisk.org> | 2016-11-16 23:20:10 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-11-16 23:20:10 -0600 |
commit | 3135a745e3e9205a7b3fb7da2ce93b05c8c42712 (patch) | |
tree | 63ebcf0916aea09ed4097875243b0eefc1d6a749 /res | |
parent | d3f921ed51b40fbf73272ebcd6f97356be2f1bd2 (diff) | |
parent | e632222bc41d860af7de2463c35de60387a2f295 (diff) |
Merge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak." into 13
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_outbound_authenticator_digest.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/res/res_pjsip_outbound_authenticator_digest.c b/res/res_pjsip_outbound_authenticator_digest.c index 8616b6caf..d4dfce447 100644 --- a/res/res_pjsip_outbound_authenticator_digest.c +++ b/res/res_pjsip_outbound_authenticator_digest.c @@ -106,6 +106,7 @@ static int digest_create_request_with_auth_from_old(const struct ast_sip_auth_ve { pjsip_auth_clt_sess auth_sess; pjsip_cseq_hdr *cseq; + pj_status_t status; if (pjsip_auth_clt_init(&auth_sess, ast_sip_get_pjsip_endpoint(), old_request->pool, 0) != PJ_SUCCESS) { @@ -115,11 +116,19 @@ static int digest_create_request_with_auth_from_old(const struct ast_sip_auth_ve if (set_outbound_authentication_credentials(&auth_sess, auths, challenge)) { ast_log(LOG_WARNING, "Failed to set authentication credentials\n"); +#if defined(HAVE_PJSIP_AUTH_CLT_DEINIT) + /* In case it is not a noop here in the future. */ + pjsip_auth_clt_deinit(&auth_sess); +#endif return -1; } - switch (pjsip_auth_clt_reinit_req(&auth_sess, challenge, - old_request, new_request)) { + status = pjsip_auth_clt_reinit_req(&auth_sess, challenge, old_request, new_request); +#if defined(HAVE_PJSIP_AUTH_CLT_DEINIT) + /* Release any cached auths */ + pjsip_auth_clt_deinit(&auth_sess); +#endif + switch (status) { case PJ_SUCCESS: /* PJSIP creates a new transaction for new_request (meaning it creates a new * branch). However, it recycles the Call-ID, from-tag, and CSeq from the |