mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Don't keep around debuglist structs when done
This commit is contained in:
parent
b9886abd86
commit
3adcc033f6
@ -395,17 +395,6 @@ add_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size FLARG) {
|
|||||||
hash = isc_hash_function(&ptr, sizeof(ptr), ISC_TRUE, NULL);
|
hash = isc_hash_function(&ptr, sizeof(ptr), ISC_TRUE, NULL);
|
||||||
idx = hash % DEBUG_TABLE_COUNT;
|
idx = hash % DEBUG_TABLE_COUNT;
|
||||||
|
|
||||||
dl = ISC_LIST_TAIL(mctx->debuglist[idx]);
|
|
||||||
if (ISC_LIKELY(dl != NULL && dl->ptr == NULL)) {
|
|
||||||
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
|
||||||
dl->ptr = ptr;
|
|
||||||
dl->size = size;
|
|
||||||
dl->file = file;
|
|
||||||
dl->line = line;
|
|
||||||
ISC_LIST_PREPEND(mctx->debuglist[idx], dl, link);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl = malloc(sizeof(debuglink_t));
|
dl = malloc(sizeof(debuglink_t));
|
||||||
INSIST(dl != NULL);
|
INSIST(dl != NULL);
|
||||||
mctx->malloced += sizeof(debuglink_t);
|
mctx->malloced += sizeof(debuglink_t);
|
||||||
@ -444,14 +433,11 @@ delete_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size,
|
|||||||
idx = hash % DEBUG_TABLE_COUNT;
|
idx = hash % DEBUG_TABLE_COUNT;
|
||||||
|
|
||||||
dl = ISC_LIST_HEAD(mctx->debuglist[idx]);
|
dl = ISC_LIST_HEAD(mctx->debuglist[idx]);
|
||||||
while (ISC_LIKELY(dl != NULL && dl->ptr != NULL)) {
|
while (ISC_LIKELY(dl != NULL)) {
|
||||||
if (ISC_UNLIKELY(dl->ptr == ptr)) {
|
if (ISC_UNLIKELY(dl->ptr == ptr)) {
|
||||||
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
||||||
dl->ptr = NULL;
|
mctx->malloced -= sizeof(*dl);
|
||||||
dl->size = 0;
|
free(dl);
|
||||||
dl->file = NULL;
|
|
||||||
dl->line = 0;
|
|
||||||
ISC_LIST_APPEND(mctx->debuglist[idx], dl, link);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dl = ISC_LIST_NEXT(dl, link);
|
dl = ISC_LIST_NEXT(dl, link);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user