[scudo] Make Ptr volatile so that the malloc and free calls are not optimized out (#149944)
This fixes the test failure seen in the discussion about https://github.com/llvm/llvm-project/pull/148066.
This commit is contained in:
parent
6752369139
commit
fcdcc4ea7a
@ -183,7 +183,8 @@ TEST_F(ScudoWrappersCDeathTest, Malloc) {
|
||||
// process doing free(P) is not a double free.
|
||||
EXPECT_DEATH(
|
||||
{
|
||||
void *Ptr = malloc(Size);
|
||||
// Note: volatile here prevents the calls from being optimized out.
|
||||
void *volatile Ptr = malloc(Size);
|
||||
free(Ptr);
|
||||
free(Ptr);
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user