From: Jenkins2 Date: Thu, 3 May 2018 16:32:08 +0000 (-0500) Subject: Merge "res_pjsip/pjsip_distributor.c: Add missing off-nominal request response." X-Git-Tag: 16.0.0-rc1~158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e228fc138eee4f569fc47b3739971653a6fcf35;p=thirdparty%2Fasterisk.git Merge "res_pjsip/pjsip_distributor.c: Add missing off-nominal request response." --- 8e228fc138eee4f569fc47b3739971653a6fcf35 diff --cc res/res_pjsip/pjsip_distributor.c index 68a0cbcc28,8a8a532562..dd2186437b --- a/res/res_pjsip/pjsip_distributor.c +++ b/res/res_pjsip/pjsip_distributor.c @@@ -734,16 -731,15 +734,17 @@@ static pj_bool_t endpoint_lookup(pjsip_ ao2_ref(unid, -1); } else if (using_auth_username) { ao2_wrlock(unidentified_requests); - /* The check again with the write lock held allows us to eliminate the DUPS_REPLACE and sort_fn */ - if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY | OBJ_NOLOCK))) { + /* Checking again with the write lock held allows us to eliminate the DUPS_REPLACE and sort_fn */ + unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, + OBJ_SEARCH_KEY | OBJ_NOLOCK); + if (unid) { check_endpoint(rdata, unid, name); } else { - unid = ao2_alloc_options(sizeof(*unid) + strlen(rdata->pkt_info.src_name) + 1, NULL, - AO2_ALLOC_OPT_LOCK_RWLOCK); + unid = ao2_alloc_options(sizeof(*unid) + strlen(rdata->pkt_info.src_name) + 1, + NULL, AO2_ALLOC_OPT_LOCK_RWLOCK); if (!unid) { ao2_unlock(unidentified_requests); + pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL); return PJ_TRUE; } strcpy(unid->src_name, rdata->pkt_info.src_name); /* Safe */