projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a160df5
)
Avoid zero length memset error
author
Renato Golin
<renato.golin@linaro.org>
Wed, 27 Aug 2014 21:58:56 +0000
(21:58 +0000)
committer
Renato Golin
<renato.golin@linaro.org>
Wed, 27 Aug 2014 21:58:56 +0000
(21:58 +0000)
Adding a check on buffer lenght to avoid a __warn_memset_zero_len
warning on GCC 4.8.2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216624
91177308
-0d34-0410-b5e6-
96231b3b80d8
include/llvm/Support/Allocator.h
patch
|
blob
|
history
diff --git
a/include/llvm/Support/Allocator.h
b/include/llvm/Support/Allocator.h
index 5f3b284532de5b2bf311a2cba9875371ae2feaa9..9ea57039a8465b07ee3f3fc8ab644d10cd52dda4 100644
(file)
--- a/
include/llvm/Support/Allocator.h
+++ b/
include/llvm/Support/Allocator.h
@@
-318,8
+318,10
@@
private:
#ifndef NDEBUG
// Poison the memory so stale pointers crash sooner. Note we must
// preserve the Size and NextPtr fields at the beginning.
- sys::Memory::setRangeWritable(*I, AllocatedSlabSize);
- memset(*I, 0xCD, AllocatedSlabSize);
+ if (AllocatedSlabSize != 0) {
+ sys::Memory::setRangeWritable(*I, AllocatedSlabSize);
+ memset(*I, 0xCD, AllocatedSlabSize);
+ }
#endif
Allocator.Deallocate(*I, AllocatedSlabSize);
}