Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 19, 2024
1 parent 15f4c73 commit 4dbcfea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions test/cfg/opencv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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
}
4 changes: 2 additions & 2 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 4dbcfea

Please sign in to comment.