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 1010| test.cpp:89:18:89:23 | call to malloc | This memory is never freed |
1111| test.cpp:156:3:156:26 | new | This memory is never freed |
1212| test.cpp:157:3:157:26 | new[] | This memory is never freed |
13+ | test.cpp: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() {
156156 new (std::nothrow) int (3 ); // BAD
157157 new (std::nothrow) int [2 ]; // BAD
158158}
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