diff options
Diffstat (limited to 'vespamalloc')
-rw-r--r-- | vespamalloc/src/tests/test1/new_test.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vespamalloc/src/tests/test1/new_test.cpp b/vespamalloc/src/tests/test1/new_test.cpp index 7988367f415..653f039bccd 100644 --- a/vespamalloc/src/tests/test1/new_test.cpp +++ b/vespamalloc/src/tests/test1/new_test.cpp @@ -98,6 +98,11 @@ TEST("verify new with alignment = 64 with single element") { #if __GLIBC_PREREQ(2, 26) TEST("verify realloarray") { void *arr = calloc(5,5); + //Used to ensure that 'arr' can not resized in place. + std::vector<std::unique_ptr<char[]>> dummies; + for (size_t i(0); i < 1000; i++) { + dummies.push_back(std::make_unique<char[]>(5*5)); + } errno = 0; void *arr2 = reallocarray(arr, 800, 5); int myErrno = errno; @@ -110,6 +115,7 @@ TEST("verify realloarray") { myErrno = errno; EXPECT_EQUAL(nullptr, arr3); EXPECT_EQUAL(ENOMEM, myErrno); + free(arr2); } #endif |