Browse Source

memalign(): have locks while updating statistics

Ioannis Koutras 12 years ago
parent
commit
296f34e629
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/memalign.c

+ 2 - 0
src/memalign.c

@@ -169,12 +169,14 @@ CheckAlignment:
 #endif /* WITH_DEBUG */
 
 #ifdef WITH_ALLOCATOR_STATS
+                LOCK_GLOBAL();
                 update_stats(&systemallocator.dmm_stats,
                         MALLOC,
 #ifdef REQUEST_SIZE_INFO
                         size,
 #endif /* REQUEST_SIZE_INFO */
                         size + sizeof(raw_block_header_t));
+                UNLOCK_GLOBAL();
 #endif /* WITH_ALLOCATOR_STATS */
 
                 *memptr = (void *)((uintptr_t) *memptr + sizeof(raw_block_header_t));