summaryrefslogtreecommitdiff
path: root/tests/test-free.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-free.c')
-rw-r--r--tests/test-free.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test-free.c b/tests/test-free.c
index 703c550e..b0c084da 100644
--- a/tests/test-free.c
+++ b/tests/test-free.c
@@ -98,6 +98,12 @@ main ()
#undef N
}
+ /* Skip this test when an address sanitizer is in use, because it would report
+ a "heap buffer overflow". */
+ #ifndef __has_feature
+ #define __has_feature(a) 0
+ #endif
+ #if !(defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer))
/* Test a less common code path.
When malloc() is based on mmap(), free() can sometimes call munmap().
munmap() usually succeeds, but fails in a particular situation: when
@@ -115,7 +121,7 @@ main ()
if (open ("/proc/sys/vm/max_map_count", O_RDONLY) >= 0)
{
/* Preparations. */
- size_t pagesize = getpagesize ();
+ size_t pagesize = sysconf (_SC_PAGESIZE);
void *firstpage_backup = malloc (pagesize);
void *lastpage_backup = malloc (pagesize);
/* Allocate a large memory area, as a bumper, so that the MAP_FIXED
@@ -170,6 +176,7 @@ main ()
}
}
#endif
+ #endif
- return 0;
+ return test_exit_status;
}