[tor-commits] [tor/master] prop224: Fix crosscert memory leaks on error

nickm at torproject.org nickm at torproject.org
Fri Nov 4 18:48:12 UTC 2016


commit 6ac85ca2b4ca669657f19afc8e622ac2dd7191d2
Author: David Goulet <dgoulet at torproject.org>
Date:   Fri Nov 4 14:14:56 2016 -0400

    prop224: Fix crosscert memory leaks on error
---
 src/or/hs_descriptor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 3986e8d..946418e 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -306,7 +306,7 @@ encode_enc_key(const ed25519_keypair_t *sig_key,
   }
   case HS_DESC_KEY_TYPE_CURVE25519:
   {
-    int signbit;
+    int signbit, ret;
     char *encoded_cert, key_fp_b64[CURVE25519_BASE64_PADDED_LEN + 1];
     ed25519_keypair_t curve_kp;
 
@@ -323,11 +323,11 @@ encode_enc_key(const ed25519_keypair_t *sig_key,
     if (!cross_cert) {
       goto err;
     }
-    if (encode_cert(cross_cert, &encoded_cert)) {
-      tor_cert_free(cross_cert);
+    ret = encode_cert(cross_cert, &encoded_cert);
+    tor_cert_free(cross_cert);
+    if (ret) {
       goto err;
     }
-    tor_cert_free(cross_cert);
     if (curve25519_public_to_base64(key_fp_b64,
                                     &ip->enc_key.curve25519.pubkey) < 0) {
       tor_free(encoded_cert);





More information about the tor-commits mailing list