]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Address coverity warnings (CID 1439133/1439132).
authorGeorge Kadianakis <desnacked@riseup.net>
Mon, 10 Sep 2018 13:47:28 +0000 (16:47 +0300)
committerGeorge Kadianakis <desnacked@riseup.net>
Mon, 10 Sep 2018 13:54:19 +0000 (16:54 +0300)
>>>>    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
src/feature/hs/hs_service.c

index 6f031eb3b92650aa500e958b98b64bfd8c129715..a6384b87a3b4150e852359baa6fb96e7a55d0bbc 100644 (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;
 }
 
index 43e5626a57f2b03ccdfb25c46a0be4d830791c27..30d23eb7715cd04df1422212fa7c0cac45f7b4b7 100644 (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;
 }