From 34a2cbb249cdaf23c88b93972a9216926a8d7551 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Mon, 10 Sep 2018 16:47:28 +0300 Subject: [PATCH] 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. --- src/feature/hs/hs_client.c | 7 +++---- src/feature/hs/hs_service.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c index 6f031eb3b9..a6384b87a3 100644 --- a/src/feature/hs/hs_client.c +++ b/src/feature/hs/hs_client.c @@ -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; } diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c index 43e5626a57..30d23eb771 100644 --- a/src/feature/hs/hs_service.c +++ b/src/feature/hs/hs_service.c @@ -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; }