2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Replace usage of isc_mem_put+isc_mem_detach with isc_mem_putanddetach

Using isc_mem_put(mctx, ...) + isc_mem_detach(mctx) required juggling with the
local variables when mctx was part of the freed object. The isc_mem_putanddetach
function can handle this case internally, but it wasn't used everywhere.  This
commit apply the semantic patching plus bit of manual work to replace all such
occurrences with proper usage of isc_mem_putanddetach().
This commit is contained in:
Ondřej Surý
2019-07-23 17:16:57 -04:00
parent d502569902
commit a6dcdc535c
13 changed files with 48 additions and 98 deletions

View File

@@ -727,7 +727,6 @@ isc_timermgr_poke(isc_timermgr_t *manager0) {
void
isc_timermgr_destroy(isc_timermgr_t **managerp) {
isc__timermgr_t *manager;
isc_mem_t *mctx;
/*
* Destroy a timer manager.
@@ -762,9 +761,7 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
isc_heap_destroy(&manager->heap);
manager->common.impmagic = 0;
manager->common.magic = 0;
mctx = manager->mctx;
isc_mem_put(mctx, manager, sizeof(*manager));
isc_mem_detach(&mctx);
isc_mem_putanddetach(&manager->mctx, manager, sizeof(*manager));
*managerp = NULL;