C++: Address review comments

This commit is contained in:
Jeroen Ketema
2024-11-12 09:08:36 +01:00
parent a5a6445b2e
commit a29b958f5f
2 changed files with 7 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
| test.cpp:31:7:31:24 | ... \|\| ... | unnecessary NULL check before call to $@ | test.cpp:35:3:35:6 | call to free | free |
| test.cpp:31:8:31:8 | x | unnecessary NULL check before call to $@ | test.cpp:35:3:35:6 | call to free | free |
| test.cpp:94:12:94:12 | x | unnecessary NULL check before call to $@ | test.cpp:94:3:94:13 | call to free | free |
| test.cpp:98:6:98:7 | ! ... | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
| test.cpp:98:7:98:7 | x | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
| test.cpp:106:6:106:17 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:107:5:107:8 | call to free | free |
| test.cpp:113:6:113:17 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:114:17:114:20 | call to free | free |
| test.cpp:98:7:98:8 | ! ... | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
| test.cpp:98:8:98:8 | x | unnecessary NULL check before call to $@ | test.cpp:101:3:101:6 | call to free | free |
| test.cpp:106:7:106:18 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:107:5:107:8 | call to free | free |
| test.cpp:113:7:113:18 | ... != ... | unnecessary NULL check before call to $@ | test.cpp:114:17:114:20 | call to free | free |

View File

@@ -95,7 +95,7 @@ void test11(char *x) {
}
bool test12(char *x) {
if(!x) // GOOD [FALSE POSITIVE]: return value depends on x
if (!x) // GOOD [FALSE POSITIVE]: return value depends on x
return false;
free(x);
@@ -103,13 +103,13 @@ bool test12(char *x) {
}
void test13(char *x) {
if(x != nullptr) // BAD
if (x != nullptr) // BAD
free(x);
}
void inspect(char *x);
void test14(char *x) {
if(x != nullptr) // GOOD [FALSE POSITIVE]: x might be accessed
if (x != nullptr) // GOOD [FALSE POSITIVE]: x might be accessed
inspect(x), free(x);
}