Skip to content

Commit 2860c0c

Browse files
committed
CPP: Move test into correct file.
1 parent d084931 commit 2860c0c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

cpp/ql/test/query-tests/Critical/MemoryFreed/MemoryFreed.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
| test.cpp:128:15:128:16 | v4 |
2727
| test.cpp:185:10:185:12 | cpy |
2828
| test.cpp:199:10:199:12 | cpy |
29-
| test.cpp:205:7:205:11 | ... = ... |
3029
| test_free.cpp:11:10:11:10 | a |
3130
| test_free.cpp:14:10:14:10 | a |
3231
| test_free.cpp:16:10:16:10 | a |
@@ -97,6 +96,7 @@
9796
| test_free.cpp:255:10:255:10 | p |
9897
| test_free.cpp:260:9:260:9 | p |
9998
| test_free.cpp:263:12:263:12 | p |
99+
| test_free.cpp:269:7:269:11 | ... = ... |
100100
| virtual.cpp:18:10:18:10 | a |
101101
| virtual.cpp:19:10:19:10 | c |
102102
| virtual.cpp:38:10:38:10 | b |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.cpp:203:12:203:17 | call to malloc | This memory allocation may not be released at $@. | test.cpp:206:1:206:1 | return ... | this exit point |
21
| test_free.cpp:36:22:36:35 | ... = ... | This memory allocation may not be released at $@. | test_free.cpp:38:1:38:1 | return ... | this exit point |
2+
| test_free.cpp:267:12:267:17 | call to malloc | This memory allocation may not be released at $@. | test_free.cpp:270:1:270:1 | return ... | this exit point |

cpp/ql/test/query-tests/Critical/MemoryFreed/test.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,3 @@ void test_strndupa_dealloc() {
198198
char *cpy = strndupa(msg, 4);
199199
free(cpy); // BAD [NOT DETECTED]
200200
}
201-
202-
void test_free_malloc() {
203-
void *a = malloc(10);
204-
void *b;
205-
free(b = a);
206-
}

cpp/ql/test/query-tests/Critical/MemoryFreed/test_free.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,10 @@ void test_ref_delete(int *&p) {
261261
p = new int;
262262
use(p); // GOOD
263263
delete p; // GOOD
264+
}
265+
266+
void test_free_assign() {
267+
void *a = malloc(10);
268+
void *b;
269+
free(b = a); // GOOD
264270
}

0 commit comments

Comments
 (0)