[Asterisk-code-review] res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup (asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue Feb 1 07:23:20 CST 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/17969 )

Change subject: res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup
......................................................................

res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup

In dev mode, if you call pjsip_auth_clt_deinit() with an auth_sess
that hasn't been initialized, it'll assert and abort.  If
digest_create_request_with_auth() fails to find the proper
auth object however, it jumps to its cleanup which does exactly
that.  So now we no longer attempt to call pjsip_auth_clt_deinit()
if we never actually initialized it.

ASTERISK-29888

Change-Id: Ib6171c25c9fe8e61cc8d11129e324c021bc30b62
---
M res/res_pjsip_outbound_authenticator_digest.c
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_pjsip_outbound_authenticator_digest.c b/res/res_pjsip_outbound_authenticator_digest.c
index e6702b4..4821082 100644
--- a/res/res_pjsip_outbound_authenticator_digest.c
+++ b/res/res_pjsip_outbound_authenticator_digest.c
@@ -563,8 +563,10 @@
 
 cleanup:
 #if defined(HAVE_PJSIP_AUTH_CLT_DEINIT)
-	/* Release any cached auths */
-	pjsip_auth_clt_deinit(&auth_sess);
+	/* If we initialized the auth_sess, clean it up */
+	if (auth_sess.endpt) {
+		pjsip_auth_clt_deinit(&auth_sess);
+	}
 #endif
 
 	ast_sip_cleanup_auth_objects_vector(&auth_objects_vector);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17969
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ib6171c25c9fe8e61cc8d11129e324c021bc30b62
Gerrit-Change-Number: 17969
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220201/ce328b77/attachment-0001.html>


More information about the asterisk-code-review mailing list