From 4dbcfea825f124b00e9ceceb61bcbc23e5e67c93 Mon Sep 17 00:00:00 2001 From: chrchr Date: Tue, 19 Mar 2024 15:50:58 +0100 Subject: [PATCH] Fix tests --- test/cfg/opencv2.cpp | 7 +++++-- test/cfg/std.cpp | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/cfg/opencv2.cpp b/test/cfg/opencv2.cpp index 7af2d6b7055..b1279fef89e 100644 --- a/test/cfg/opencv2.cpp +++ b/test/cfg/opencv2.cpp @@ -28,7 +28,9 @@ void validCode(const char* argStr) cvStr += " World"; std::cout << cvStr; - char * pBuf = (char *)cv::fastMalloc(20); // cppcheck-suppress cstyleCast + // cppcheck-suppress [cstyleCast, unusedAllocatedMemory] + char * pBuf = (char *)cv::fastMalloc(20); + // cppcheck-suppress uninitdata cv::fastFree(pBuf); } @@ -40,7 +42,8 @@ void ignoredReturnValue() void memleak() { - const char * pBuf = (char *)cv::fastMalloc(1000); // cppcheck-suppress cstyleCast + // cppcheck-suppress [cstyleCast, unusedAllocatedMemory] + const char * pBuf = (char *)cv::fastMalloc(1000); std::cout << pBuf; // cppcheck-suppress memleak } diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index d27a87d0b47..0438ea39487 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2923,7 +2923,7 @@ void uninitvar_longjmp(void) void uninitvar_malloc(void) { size_t size; - // cppcheck-suppress [uninitvar, cstyleCast] + // cppcheck-suppress [uninitvar, cstyleCast, unusedAllocatedMemory] int *p = (int*)std::malloc(size); free(p); } @@ -4949,7 +4949,7 @@ void std_vector_data_arithmetic() void memleak_std_malloc() // #12332 { - //cppcheck-suppress [unreadVariable, constVariablePointer] + //cppcheck-suppress [unreadVariable, constVariablePointer, unusedAllocatedMemory] void* p = std::malloc(1); //cppcheck-suppress memleak }