aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2016-11-04 14:14:56 -0400
committerNick Mathewson <nickm@torproject.org>2016-11-04 14:16:42 -0400
commit6ac85ca2b4ca669657f19afc8e622ac2dd7191d2 (patch)
tree01005fd6fd484f2bc686313ccd67c816e15092c1 /src
parent29ae8dcf96532eb5be8023a29de404576d5d2339 (diff)
downloadtor-6ac85ca2b4ca669657f19afc8e622ac2dd7191d2.tar.gz
tor-6ac85ca2b4ca669657f19afc8e622ac2dd7191d2.zip
prop224: Fix crosscert memory leaks on error
Diffstat (limited to 'src')
-rw-r--r--src/or/hs_descriptor.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 3986e8d59c..946418e946 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);