diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-11-02 08:38:52 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-11-02 08:38:52 +0300 |
commit | 54522af853de28f45195044dadfd795c4e5942aa (patch) | |
tree | fe446ca74cd7d1829d5f44660368ebb53e643e09 /tests/leak.c | |
parent | a17fd4340b92ecc3f263f731bdaf8ff65bc6e67c (diff) | |
download | bdwgc-54522af853de28f45195044dadfd795c4e5942aa.tar.gz |
Redirect reallocarray() in leak_detector.h
Issue #491 (bdwgc).
* doc/leak.md: Mention reallocarray function; reorder redirected
functions list.
* include/gc/leak_detector.h (reallocarray): Redefine to GC_REALLOC().
* tests/leak.c (main): Call reallocarray() in a loop.
Diffstat (limited to 'tests/leak.c')
-rw-r--r-- | tests/leak.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/leak.c b/tests/leak.c index 3a4e4f8c..900139c1 100644 --- a/tests/leak.c +++ b/tests/leak.c @@ -19,7 +19,8 @@ int main(void) { } CHECK_LEAKS(); for (i = 1; i < N_TESTS / 2; ++i) { - p[i] = (char*)realloc(p[i], i * 16 + 1); + p[i] = (char*)((i & 1) != 0 ? reallocarray(p[i], i, 43) + : realloc(p[i], i * 16 + 1)); } CHECK_LEAKS(); for (i = 1; i < N_TESTS; ++i) { |