Ensure that array is not resized in place.
@@ -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
