C++: Add a testcase that needs heuristic allocation.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-05-10 08:21:21 +01:00
parent 1a57f81aca
commit 023b8e4f15

View File

@@ -243,3 +243,9 @@ void test_flow_through_setter(unsigned size) {
memset(str.string, 0, size + 1); // BAD
}
void* my_alloc(unsigned size);
void foo(unsigned size) {
int* p = (int*)my_alloc(size); // BAD [NOT DETECTED]
memset(p, 0, size + 1);
}