summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-01-29 08:19:11 +0000
committerAlexey Samsonov <samsonov@google.com>2013-01-29 08:19:11 +0000
commit9aa2e4f5c41c76ea8d7941cfa73c8cd4df45cdf6 (patch)
treef2c6a4aa21f3812987419be3f22bae4f35405a98 /compiler-rt
parentc048154b9b2aeb536a166a6ca8bec7db43355bf2 (diff)
downloadbcm5719-llvm-9aa2e4f5c41c76ea8d7941cfa73c8cd4df45cdf6.tar.gz
bcm5719-llvm-9aa2e4f5c41c76ea8d7941cfa73c8cd4df45cdf6.zip
[ASan] fix deallocation hook in allocator2: according to specification, dealloc hook should be called before deallocating memory
llvm-svn: 173778
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/asan/asan_allocator2.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/asan_allocator2.cc b/compiler-rt/lib/asan/asan_allocator2.cc
index a77b92c83bf..15bdb83141f 100644
--- a/compiler-rt/lib/asan/asan_allocator2.cc
+++ b/compiler-rt/lib/asan/asan_allocator2.cc
@@ -419,6 +419,7 @@ static void *Allocate(uptr size, uptr alignment, StackTrace *stack,
static void Deallocate(void *ptr, StackTrace *stack, AllocType alloc_type) {
uptr p = reinterpret_cast<uptr>(ptr);
if (p == 0) return;
+ ASAN_FREE_HOOK(ptr);
uptr chunk_beg = p - kChunkHeaderSize;
AsanChunk *m = reinterpret_cast<AsanChunk *>(chunk_beg);
@@ -468,8 +469,6 @@ static void Deallocate(void *ptr, StackTrace *stack, AllocType alloc_type) {
quarantine.Put(&fallback_quarantine_cache, QuarantineCallback(ac),
m, m->UsedSize());
}
-
- ASAN_FREE_HOOK(ptr);
}
static void *Reallocate(void *old_ptr, uptr new_size, StackTrace *stack) {
OpenPOWER on IntegriCloud