Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9283912 + 244966e commit fe76b08Copy full SHA for fe76b08
2 files changed
cpp/ql/test/query-tests/Critical/MemoryFreed/MemoryNeverFreed.expected
@@ -10,3 +10,4 @@
10
| test.cpp:89:18:89:23 | call to malloc | This memory is never freed |
11
| test.cpp:156:3:156:26 | new | This memory is never freed |
12
| 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 |
cpp/ql/test/query-tests/Critical/MemoryFreed/test.cpp
@@ -156,3 +156,15 @@ int overloadedNew() {
156
new(std::nothrow) int(3); // BAD
157
new(std::nothrow) int[2]; // BAD
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
+}
0 commit comments