File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
cpp/ql/test/experimental/query-tests/Best Practices/GuardedFree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 4
4
| test.cpp:31:7:31:24 | ... \|\| ... | unnecessary NULL check before call to $@ | test.cpp:35:3:35:6 | call to free | free |
5
5
| test.cpp:31:8:31:8 | x | unnecessary NULL check before call to $@ | test.cpp:35:3:35:6 | call to free | free |
6
6
| test.cpp:94:12:94:12 | x | unnecessary NULL check before call to $@ | test.cpp:94:3:94:13 | call to free | free |
7
- | test.cpp:98:6 :98:7 | ! ... | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
8
- | test.cpp:98:7 :98:7 | x | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
9
- | test.cpp:106:6 :106:17 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:107:5:107:8 | call to free | free |
10
- | test.cpp:113:6 :113:17 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:114:17:114:20 | call to free | free |
7
+ | test.cpp:98:7 :98:8 | ! ... | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
8
+ | test.cpp:98:8 :98:8 | x | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
9
+ | test.cpp:106:7 :106:18 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:107:5:107:8 | call to free | free |
10
+ | test.cpp:113:7 :113:18 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:114:17:114:20 | call to free | free |
Original file line number Diff line number Diff line change @@ -95,21 +95,21 @@ void test11(char *x) {
95
95
}
96
96
97
97
bool test12 (char *x) {
98
- if (!x) // GOOD [FALSE POSITIVE]: return value depends on x
98
+ if (!x) // GOOD [FALSE POSITIVE]: return value depends on x
99
99
return false ;
100
100
101
101
free (x);
102
102
return true ;
103
103
}
104
104
105
105
void test13 (char *x) {
106
- if (x != nullptr ) // BAD
106
+ if (x != nullptr ) // BAD
107
107
free (x);
108
108
}
109
109
110
110
void inspect (char *x);
111
111
112
112
void test14 (char *x) {
113
- if (x != nullptr ) // GOOD [FALSE POSITIVE]: x might be accessed
113
+ if (x != nullptr ) // GOOD [FALSE POSITIVE]: x might be accessed
114
114
inspect (x), free (x);
115
115
}
You can’t perform that action at this time.
0 commit comments