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

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



commit 6ac85ca2b4ca669657f19afc8e622ac2dd7191d2
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
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);



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