diff --git a/libc/src/string/strcat/strcat_test.cpp b/libc/src/string/strcat/strcat_test.cpp --- a/libc/src/string/strcat/strcat_test.cpp +++ b/libc/src/string/strcat/strcat_test.cpp @@ -13,7 +13,7 @@ TEST(StrCatTest, EmptyDest) { std::string abc = "abc"; - char *dest = new char[4]; + char dest[4]; dest[0] = '\0'; @@ -21,13 +21,11 @@ ASSERT_EQ(dest, result); ASSERT_EQ(std::string(dest), abc); ASSERT_EQ(std::string(dest).size(), abc.size()); - - delete[] dest; } TEST(StrCatTest, NonEmptyDest) { std::string abc = "abc"; - char *dest = new char[4]; + char dest[7]; dest[0] = 'x'; dest[1] = 'y'; @@ -38,6 +36,4 @@ ASSERT_EQ(dest, result); ASSERT_EQ(std::string(dest), std::string("xyz") + abc); ASSERT_EQ(std::string(dest).size(), abc.size() + 3); - - delete[] dest; } diff --git a/libc/src/string/strcpy/strcpy_test.cpp b/libc/src/string/strcpy/strcpy_test.cpp --- a/libc/src/string/strcpy/strcpy_test.cpp +++ b/libc/src/string/strcpy/strcpy_test.cpp @@ -13,19 +13,17 @@ TEST(StrCpyTest, EmptyDest) { std::string abc = "abc"; - char *dest = new char[4]; + char dest[4]; char *result = __llvm_libc::strcpy(dest, abc.c_str()); ASSERT_EQ(dest, result); ASSERT_EQ(std::string(dest), abc); ASSERT_EQ(std::string(dest).size(), abc.size()); - - delete[] dest; } TEST(StrCpyTest, OffsetDest) { std::string abc = "abc"; - char *dest = new char[7]; + char dest[7]; dest[0] = 'x'; dest[1] = 'y'; @@ -35,6 +33,4 @@ ASSERT_EQ(dest + 3, result); ASSERT_EQ(std::string(dest), std::string("xyz") + abc); ASSERT_EQ(std::string(dest).size(), abc.size() + 3); - - delete[] dest; }