File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
cpp/ql/test/query-tests/Critical/MemoryFreed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 10
10
| test.cpp:89:18:89:23 | call to malloc | This memory is never freed |
11
11
| test.cpp:156:3:156:26 | new | This memory is never freed |
12
12
| test.cpp:157:3:157:26 | new[] | This memory is never freed |
13
+ | test.c
A335
pp:167:14:167:19 | call to strdup | This memory is never freed |
Original file line number Diff line number Diff line change @@ -156,3 +156,15 @@ int overloadedNew() {
156
156
new (std::nothrow) int (3 ); // BAD
157
157
new (std::nothrow) int [2 ]; // BAD
158
158
}
159
+
160
+ // --- strdup ---
161
+
162
+ char *strdup (const char *s1);
163
+ void output_msg (const char *msg);
164
+
165
+ void test_strdup () {
166
+ char msg[] = " OctoCat" ;
167
+ char *cpy = strdup (msg); // BAD
168
+
169
+ output_msg (cpy);
170
+ }
You can’t perform that action at this time.
0 commit comments