diff --git a/res/res_pjsip_outbound_authenticator_digest.c b/res/res_pjsip_outbound_authenticator_digest.c index e6702b4df2930e83ab8a78d3984028c6e463c202..4821082a9f538eb2b0fc636f09a26894ae046d5b 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);