Browse Source

Remove needless check for a buffer that could not be NULL.

Fixes coverity CID 508: coverity scan doesn't like checking a
variable for non-NULL after it has been definitely dereferenced.

This should take us back down to zero coverity issues.
Nick Mathewson 13 years ago
parent
commit
4db5a1e151
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/common/crypto.c

+ 3 - 4
src/common/crypto.c

@@ -1051,10 +1051,9 @@ crypto_pk_public_hybrid_encrypt(crypto_pk_t *env,
   tor_assert(outlen+symlen < INT_MAX);
   return (int)(outlen + symlen);
  err:
-  if (buf) {
-    memset(buf, 0, pkeylen);
-    tor_free(buf);
-  }
+
+  memset(buf, 0, pkeylen);
+  tor_free(buf);
   crypto_cipher_free(cipher);
   return -1;
 }