Skip to content

Commit

Permalink
Drop unnecessary NULL check
Browse files Browse the repository at this point in the history
The variable `key` is checked in the beginning of the function to be
non-NULL.
In the while loop it gets modified via `key++;` making it impossible to
be NULL after the loop.

check_after_deref: Null-checking key suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

Found by Coverity
  • Loading branch information
cgzones committed May 25, 2021
1 parent 20242ee commit a28b871
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/persistence.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ migrate_unique_key (char *key) {
key++;
delims++;
}
if (key && delims == 2) {
if (delims == 2) {
sprintf (agent_hex, "%" PRIx32, djb2 ((unsigned char *) key));
append_str (&nkey, agent_hex);
}
Expand Down

0 comments on commit a28b871

Please sign in to comment.