浏览代码

Fix a bug in earlier torcert fix, fix another.

Nick Mathewson 9 年之前
父节点
当前提交
49c31877b6
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/or/torcert.c

+ 5 - 3
src/or/torcert.c

@@ -68,13 +68,15 @@ tor_cert_sign_impl(const ed25519_keypair_t *signing_key,
 
   tor_free(encoded);
 
-  return torcert;
+  goto done;
 
  err:
   tor_cert_free(torcert);
+  torcert = NULL;
+ done:
   ed25519_cert_free(cert);
   tor_free(encoded);
-  return NULL;
+  return torcert;
 }
 
 /**
@@ -151,7 +153,7 @@ tor_cert_parse(const uint8_t *encoded, const size_t len)
   cert = NULL;
  done:
   ed25519_cert_free(parsed);
-  return NULL;
+  return cert;
 }
 
 /** Fill in <b>checkable_out</b> with the information needed to check