mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
Avoid zero length memset error
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
This commit is contained in:
parent
a160df5b42
commit
96c845a36c
@ -318,8 +318,10 @@ private:
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Poison the memory so stale pointers crash sooner. Note we must
|
// Poison the memory so stale pointers crash sooner. Note we must
|
||||||
// preserve the Size and NextPtr fields at the beginning.
|
// preserve the Size and NextPtr fields at the beginning.
|
||||||
sys::Memory::setRangeWritable(*I, AllocatedSlabSize);
|
if (AllocatedSlabSize != 0) {
|
||||||
memset(*I, 0xCD, AllocatedSlabSize);
|
sys::Memory::setRangeWritable(*I, AllocatedSlabSize);
|
||||||
|
memset(*I, 0xCD, AllocatedSlabSize);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
Allocator.Deallocate(*I, AllocatedSlabSize);
|
Allocator.Deallocate(*I, AllocatedSlabSize);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user