From fa4a75a26cee8c3c8761d7deb21d2576d1379a75 Mon Sep 17 00:00:00 2001 From: Jaydeep <106300970+jaydeeppatel1111@users.noreply.github.com> Date: Wed, 3 Dec 2025 23:03:50 +0530 Subject: [PATCH] SWDEV-563114 - User stack array instead to avoid delete gets skipped in case of assert failure. (#1553) --- .../hip-tests/catch/unit/kernel/hipPrintfKernel.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/projects/hip-tests/catch/unit/kernel/hipPrintfKernel.cc b/projects/hip-tests/catch/unit/kernel/hipPrintfKernel.cc index 90f7424488..d24ad51768 100644 --- a/projects/hip-tests/catch/unit/kernel/hipPrintfKernel.cc +++ b/projects/hip-tests/catch/unit/kernel/hipPrintfKernel.cc @@ -17,7 +17,7 @@ OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include - +#include #include #include "../kernel/printf_common.h" @@ -56,13 +56,11 @@ TEST_CASE("Unit_kernel_ChkPrintf", "[multigpu]") { if (!HipTest::isPcieAtomicSupported()) continue; hipLaunchKernelGGL(run_printf, dim3(1), dim3(1), 0, 0); HIP_CHECK(hipDeviceSynchronize()); - char* data = new char[st.size()]; - ; + std::vector data(st.size() + 1); // +1 for null terminator std::ifstream CapturedData = capture.getCapturedData(); - CapturedData.getline(data, st.size() + 1); - int result = strcmp(data, check); + CapturedData.getline(data.data(), st.size() + 1); + int result = strcmp(data.data(), check); REQUIRE(result == 0); - delete[] data; } }