[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. (cherry picked from commit fcdcc4ea7ac960c79246b3bd428f14ea350e63e2)
This commit is contained in:
parent
3b53c84e33
commit
d436146305
@ -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