forked from OSchip/llvm-project
parent
c9db3b8b39
commit
322d7fbd9d
|
@ -394,19 +394,19 @@ TEST(AddressSanitizer, ReallocTest) {
|
|||
TEST(AddressSanitizer, ZeroSizeMallocTest) {
|
||||
// Test that malloc(0) and similar functions don't return NULL.
|
||||
void *ptr = Ident(malloc(0));
|
||||
EXPECT_FALSE(0 == ptr);
|
||||
EXPECT_TRUE(NULL != ptr);
|
||||
free(ptr);
|
||||
#if !defined(__APPLE__) && !defined(ANDROID) && !defined(__ANDROID__)
|
||||
int pm_res = posix_memalign(&ptr, 1<<20, 0);
|
||||
EXPECT_EQ(0, pm_res);
|
||||
EXPECT_FALSE(0 == ptr);
|
||||
EXPECT_TRUE(NULL != ptr);
|
||||
free(ptr);
|
||||
#endif
|
||||
int *int_ptr = new int [0];
|
||||
int *int_ptr = new int[0];
|
||||
int *int_ptr2 = new int[0];
|
||||
EXPECT_FALSE(0 == int_ptr);
|
||||
EXPECT_FALSE(0 == int_ptr2);
|
||||
EXPECT_FALSE(int_ptr == int_ptr2);
|
||||
EXPECT_TRUE(NULL != int_ptr);
|
||||
EXPECT_TRUE(NULL != int_ptr2);
|
||||
EXPECT_NE(int_ptr, int_ptr2);
|
||||
delete[] int_ptr;
|
||||
delete[] int_ptr2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue