diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-06-30 07:16:50 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-06-30 07:16:50 +0000 |
commit | 5d61c4d6862f989965b4af156a9a52cc2538b410 (patch) | |
tree | 1b8f8a119cb7d415fa5c4830d94b262425df8642 /vespamalloc | |
parent | a4c33e270068174c1b2ff5ffea94f90e3e93ccc5 (diff) |
Ensure that array is not resized in place.
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 |