From: George Joseph Date: Mon, 31 Jan 2022 13:09:09 +0000 (-0700) Subject: res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup X-Git-Tag: 19.2.0-rc1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4142e548e8971515e4d4e3dfd71fbb8a77f82719;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_outbound_authenticator_digest.c b/res/res_pjsip_outbound_authenticator_digest.c index e6702b4df2..4821082a9f 100644 --- a/res/res_pjsip_outbound_authenticator_digest.c +++ b/res/res_pjsip_outbound_authenticator_digest.c @@ -563,8 +563,10 @@ static int digest_create_request_with_auth(const struct ast_sip_auth_vector *aut 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);