]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Use VG_(arena_memalign) for thread array rather than VG_(malloc)-ed + align
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 21 Aug 2015 22:22:27 +0000 (22:22 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 21 Aug 2015 22:22:27 +0000 (22:22 +0000)
Objective is to avoid a 'possibly lost' leak when self-hosting
(and re-uses the already existing align logic in m_mallocfree.c)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15581

coregrind/m_threadstate.c

index c4cf55b77ea6301bf01348287963bfff8d623fc5..6cea270bd8ecf376675f2c3a64f1cc0f9ffd9ae3 100644 (file)
@@ -54,14 +54,10 @@ UInt VG_N_THREADS;
 void VG_(init_Threads)(void)
 {
    ThreadId tid;
-   UChar *addr, *aligned_addr;
 
-   addr = VG_(malloc)("init_Threads",
-          VG_N_THREADS * sizeof VG_(threads)[0] + LibVEX_GUEST_STATE_ALIGN - 1);
-
-   // Align
-   aligned_addr = addr + (Addr)addr % LibVEX_GUEST_STATE_ALIGN;
-   VG_(threads) = (ThreadState *)aligned_addr;
+   VG_(threads) = VG_(arena_memalign) (VG_AR_CORE, "init_Threads",
+                                       LibVEX_GUEST_STATE_ALIGN,
+                                       VG_N_THREADS * sizeof VG_(threads)[0]);
 
    for (tid = 1; tid < VG_N_THREADS; tid++) {
       INNER_REQUEST(