[or-cvs] r17676: {tor} Fix more leaks in unit tests. (tor/trunk/src/or)

nickm at seul.org nickm at seul.org
Thu Dec 18 06:02:24 UTC 2008


Author: nickm
Date: 2008-12-18 01:02:23 -0500 (Thu, 18 Dec 2008)
New Revision: 17676

Modified:
   tor/trunk/src/or/test.c
Log:
Fix more leaks in unit tests.

Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c	2008-12-18 05:47:34 UTC (rev 17675)
+++ tor/trunk/src/or/test.c	2008-12-18 06:02:23 UTC (rev 17676)
@@ -3100,7 +3100,7 @@
 {
   authority_cert_t *cert1=NULL, *cert2=NULL, *cert3=NULL;
   crypto_pk_env_t *sign_skey_1=NULL, *sign_skey_2=NULL, *sign_skey_3=NULL;
-  crypto_pk_env_t *sign_skey_leg1;
+  crypto_pk_env_t *sign_skey_leg1=NULL;
   const char *msg=NULL;
 
   time_t now = time(NULL);
@@ -3570,6 +3570,8 @@
     crypto_free_pk_env(sign_skey_2);
   if (sign_skey_3)
     crypto_free_pk_env(sign_skey_3);
+  if (sign_skey_leg1)
+    crypto_free_pk_env(sign_skey_leg1);
   if (cert1)
     authority_cert_free(cert1);
   if (cert2)
@@ -4323,7 +4325,7 @@
     rend_intro_point_t *intro = tor_malloc_zero(sizeof(rend_intro_point_t));
     crypto_pk_env_t *okey = pk_generate(2 + i);
     intro->extend_info = tor_malloc_zero(sizeof(extend_info_t));
-    intro->extend_info->onion_key = crypto_pk_dup_key(okey);
+    intro->extend_info->onion_key = okey;
     crypto_pk_get_digest(intro->extend_info->onion_key,
                          intro->extend_info->identity_digest);
     //crypto_rand(info->identity_digest, DIGEST_LEN); /* Would this work? */
@@ -4385,7 +4387,7 @@
     rend_service_descriptor_free(generated);
   if (pk1)
     crypto_free_pk_env(pk1);
-  if (pk1)
+  if (pk2)
     crypto_free_pk_env(pk2);
   tor_free(intro_points_encrypted);
 }



More information about the tor-commits mailing list