Refactor *_destroy and *_detach functions to unified order of actions.
This properly orders clearing the freed pointer and calling isc_refcount_destroy as early as possible to have ability to put proper memory barrier when cleaning up reference counting.
This commit is contained in:
@@ -127,9 +127,9 @@ void
|
||||
ns_server_detach(ns_server_t **sctxp) {
|
||||
ns_server_t *sctx;
|
||||
|
||||
REQUIRE(sctxp != NULL);
|
||||
REQUIRE(sctxp != NULL && SCTX_VALID(*sctxp));
|
||||
sctx = *sctxp;
|
||||
REQUIRE(SCTX_VALID(sctx));
|
||||
*sctxp = NULL;
|
||||
|
||||
if (isc_refcount_decrement(&sctx->references) == 1) {
|
||||
ns_altsecret_t *altsecret;
|
||||
@@ -185,8 +185,6 @@ ns_server_detach(ns_server_t **sctxp) {
|
||||
|
||||
isc_mem_putanddetach(&sctx->mctx, sctx, sizeof(*sctx));
|
||||
}
|
||||
|
||||
*sctxp = NULL;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
Reference in New Issue
Block a user