[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove needless check for a buffer that could not be NULL.



commit 4db5a1e151a7aa69f2682854b021d1f9bb0f5caf
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Apr 18 10:38:39 2012 -0400

    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.
---
 src/common/crypto.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/common/crypto.c b/src/common/crypto.c
index dd85d14..e37b282 100644
--- a/src/common/crypto.c
+++ b/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;
 }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits