adb = *adbx;
*adbx = NULL;
- INSIST(adb->erefcnt > 0);
-
LOCK(&adb->reflock);
+ INSIST(adb->erefcnt > 0);
adb->erefcnt--;
need_exit_check = (adb->erefcnt == 0 && adb->irefcnt == 0);
UNLOCK(&adb->reflock);
fprintf(f, "; [edns success/4096 timeout/1432 timeout/1232 timeout/"
"512 timeout]\n");
fprintf(f, "; [plain success/timeout]\n;\n");
- if (debug)
+ if (debug) {
+ LOCK(&adb->reflock);
fprintf(f, "; addr %p, erefcnt %u, irefcnt %u, finds out %u\n",
adb, adb->erefcnt, adb->irefcnt,
isc_mempool_getallocated(adb->nhmp));
+ UNLOCK(&adb->reflock);
+ }
/*
* In TSAN mode we need to lock the locks individually, as TSAN