]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use _int_free_chunk in tcache_thread_shutdown
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 3 Apr 2025 14:24:22 +0000 (14:24 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Mon, 4 Aug 2025 17:13:55 +0000 (17:13 +0000)
malloc/malloc.c

index 151e6c615e9240f8a4b8947c091b9b99d687b03a..2ac562506e4d877fe16da1d37209f799d3f4c7f8 100644 (file)
@@ -3293,6 +3293,7 @@ static void
 tcache_thread_shutdown (void)
 {
   int i;
+  mchunkptr p;
   tcache_perthread_struct *tcache_tmp = tcache;
 
   tcache_shutting_down = true;
@@ -3314,11 +3315,14 @@ tcache_thread_shutdown (void)
            malloc_printerr ("tcache_thread_shutdown(): "
                             "unaligned tcache chunk detected");
          tcache_tmp->entries[i] = REVEAL_PTR (e->next);
-         __libc_free (e);
+         e->key = 0;
+         p = mem2chunk (e);
+         _int_free_chunk (arena_for_chunk (p), p, chunksize (p), 0);
        }
     }
 
-  __libc_free (tcache_tmp);
+  p = mem2chunk (tcache_tmp);
+  _int_free_chunk (arena_for_chunk (p), p, chunksize (p), 0);
 }
 
 /* Initialize tcache.  In the rare case there isn't any memory available,