summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-11-02 08:09:13 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-11-02 08:18:22 +0300
commita17fd4340b92ecc3f263f731bdaf8ff65bc6e67c (patch)
tree4f97b127416b25751dd9055f2b587727f5f93502 /tests
parent07e4343f292ce70c4a0e59080c503fc63016486c (diff)
downloadbdwgc-a17fd4340b92ecc3f263f731bdaf8ff65bc6e67c.tar.gz
Test realloc() in leaktest
* tests/leak.c (main): Call realloc() N_TESTS/2-1 times and then call CHECK_LEAKS().
Diffstat (limited to 'tests')
-rw-r--r--tests/leak.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/leak.c b/tests/leak.c
index b54b3227..3a4e4f8c 100644
--- a/tests/leak.c
+++ b/tests/leak.c
@@ -13,10 +13,15 @@ int main(void) {
GC_INIT(); /* Needed if thread-local allocation is enabled. */
/* FIXME: This is not ideal. */
+
for (i = 0; i < N_TESTS; ++i) {
p[i] = (char*)malloc(sizeof(int)+i);
}
CHECK_LEAKS();
+ for (i = 1; i < N_TESTS / 2; ++i) {
+ p[i] = (char*)realloc(p[i], i * 16 + 1);
+ }
+ CHECK_LEAKS();
for (i = 1; i < N_TESTS; ++i) {
free(p[i]);
}