summaryrefslogtreecommitdiff
path: root/tests/test-free.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-10-20 15:22:21 +0200
committerJörg Frings-Fürst <debian@jff.email>2024-10-20 15:22:21 +0200
commit1d8b9e17ea13630aec475484da09ebba0366f7c8 (patch)
tree0c801f68561bfb0930a4ade80d7ca3a7940887ab /tests/test-free.c
parent84e26c587987e8484d55db4165f188b40c09e94b (diff)
parent630f99f29bd31a76d8d24da2975a045452c763ef (diff)
Merge branch 'feature/upstream' into develop
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;
}