Perform request validation in req_response() before using the pointer

The 'request' pointer is used before it is checked. Perform the check
before using the pointer.
This commit is contained in:
Aram Sargsyan
2022-12-12 12:08:16 +00:00
committed by Arаm Sаrgsyаn
parent 643abfbba7
commit 5b37359697

View File

@@ -972,6 +972,8 @@ req_response(isc_result_t result, isc_region_t *region, void *arg) {
req_log(ISC_LOG_DEBUG(3), "req_response: request %p: %s", request,
isc_result_totext(result));
REQUIRE(VALID_REQUEST(request));
if (result == ISC_R_TIMEDOUT) {
LOCK(&request->requestmgr->locks[request->hash]);
if (request->udpcount > 1) {
@@ -989,8 +991,6 @@ req_response(isc_result_t result, isc_region_t *region, void *arg) {
goto done;
}
REQUIRE(VALID_REQUEST(request));
LOCK(&request->requestmgr->locks[request->hash]);
if (result != ISC_R_SUCCESS) {