Address coverity warnings (CID 1439133/1439132).

>>>>    CID 1439133:  Null pointer dereferences  (REVERSE_INULL)
>>>>    Null-checking "fields" suggests that it may be null, but it
>>>> has already been dereferenced on all paths leading to the check.

>>>>    CID 1439132:  Null pointer dereferences  (REVERSE_INULL)
>>>>    Null-checking "fields" suggests that it may be null, but it
>>>> has already been dereferenced on all paths leading to the check.
This commit is contained in:
George Kadianakis 2018-09-10 16:47:28 +03:00
parent a52d5d5309
commit 34a2cbb249
2 changed files with 6 additions and 8 deletions

View File

@ -1524,10 +1524,9 @@ parse_auth_file_content(const char *client_key_str)
if (seckey_b32) {
memwipe(seckey_b32, 0, strlen(seckey_b32));
}
if (fields) {
SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
smartlist_free(fields);
}
tor_assert(fields);
SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
smartlist_free(fields);
return auth;
}

View File

@ -1192,10 +1192,9 @@ parse_authorized_client(const char *client_key_str)
if (pubkey_b32) {
memwipe(pubkey_b32, 0, strlen(pubkey_b32));
}
if (fields) {
SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
smartlist_free(fields);
}
tor_assert(fields);
SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
smartlist_free(fields);
return client;
}