From feb6282be9f7fe02300f2c5397593c536d945ac3 Mon Sep 17 00:00:00 2001 From: Kevin Cadieux Date: Wed, 10 Mar 2021 22:52:21 -0800 Subject: [PATCH] Fixing stack-use-after-scope ASan error detected in the [Allocator] test. --- test/source/TestAllocator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/source/TestAllocator.cpp b/test/source/TestAllocator.cpp index 8cfaadd6..85f5adf0 100644 --- a/test/source/TestAllocator.cpp +++ b/test/source/TestAllocator.cpp @@ -129,7 +129,6 @@ static int TestFixedAllocator() typedef eastl::list IntList; typedef IntList::node_type IntListNode; - IntList intList1; const size_t kAlignOfIntListNode = EA_ALIGN_OF(IntListNode); // ensure the fixed buffer contains the default value that will be replaced @@ -140,6 +139,8 @@ static int TestFixedAllocator() EATEST_VERIFY(buffer1[i].mValue == DEFAULT_VALUE); } + IntList intList1; + // replace all the values in the local buffer with the test value intList1.get_allocator().init(buffer1, sizeof(buffer1), sizeof(IntListNode), kAlignOfIntListNode); for (size_t i = 0; i < kBufferCount; i++)