diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-06-30 13:37:40 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-06-30 13:37:40 -0400 |
commit | 624ac93ac5673cf88a426de054d36c61503c1779 (patch) | |
tree | 55dd26f97394fae67b8c7c3efa62b4d21766fd5a | |
parent | bd7dee4575e43e097abc1f129179c61869c3fce9 (diff) |
add a third round that forces new allocation
-rw-r--r-- | test/realloc.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); } |