From 624ac93ac5673cf88a426de054d36c61503c1779 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 30 Jun 2020 13:37:40 -0400 Subject: add a third round that forces new allocation --- test/realloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/realloc.c b/test/realloc.c index c54f270..8106b1f 100644 --- a/test/realloc.c +++ b/test/realloc.c @@ -13,6 +13,10 @@ int main(void) printf("%p: %s\n", ptr, ptr); ptr = map_realloc(ptr, sizeof(buf) * 2); - memcpy(ptr + sizeof(buf), buf, sizeof(buf)); + memcpy(ptr + sizeof(buf) - 1, buf, sizeof(buf)); + printf("%p: %s\n", ptr, ptr); + + ptr = map_realloc(ptr, sizeof(buf) * sysconf(_SC_PAGESIZE)); + memcpy(ptr + (2 * sizeof(buf)) - 2, buf, sizeof(buf)); printf("%p: %s\n", ptr, ptr); } -- cgit v1.2.1