Browse Source

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.
George Kadianakis 5 years ago
parent
commit
34a2cbb249
2 changed files with 6 additions and 8 deletions
  1. 3 4
      src/feature/hs/hs_client.c
  2. 3 4
      src/feature/hs/hs_service.c

+ 3 - 4
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;
 }
 

+ 3 - 4
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;
 }