]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't keep around debuglist structs when done
authorMukund Sivaraman <muks@isc.org>
Wed, 9 May 2018 06:21:22 +0000 (11:51 +0530)
committerMark Andrews <marka@isc.org>
Fri, 11 May 2018 01:17:14 +0000 (11:17 +1000)
lib/isc/mem.c

index a5f88c5c8f76c6aa9d84fab5092ed43e6ca3c925..ff541d54162922dda70ff36bde87d7aa8eab5c85 100644 (file)
@@ -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);
        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));
        INSIST(dl != NULL);
        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;
 
        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)) {
                        ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
-                       dl->ptr = NULL;
-                       dl->size = 0;
-                       dl->file = NULL;
-                       dl->line = 0;
-                       ISC_LIST_APPEND(mctx->debuglist[idx], dl, link);
+                       mctx->malloced -= sizeof(*dl);
+                       free(dl);
                        return;
                }
                dl = ISC_LIST_NEXT(dl, link);