diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-05 02:05:39 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-05 02:05:39 +0000 |
commit | 475fbbbccc64bb48b3336c5872913c45b43c8aad (patch) | |
tree | 3df52a386f25cff14b9b0416ec3e57253b9df0bb | |
parent | 1affbd3464e3717917179bba0cbdc1d76b06b21a (diff) | |
download | tor-475fbbbccc64bb48b3336c5872913c45b43c8aad.tar tor-475fbbbccc64bb48b3336c5872913c45b43c8aad.tar.gz |
Fix a resource leak in test_dir_formats()
svn:r17488
-rw-r--r-- | src/or/test.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/test.c b/src/or/test.c index b982c307d..dad0f41ed 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -2673,7 +2673,7 @@ test_dir_format(void) char fingerprint[FINGERPRINT_LEN+1]; char *pk1_str = NULL, *pk2_str = NULL, *pk3_str = NULL, *cp; size_t pk1_str_len, pk2_str_len, pk3_str_len; - routerinfo_t *r1, *r2; + routerinfo_t *r1=NULL, *r2=NULL; crypto_pk_env_t *pk1 = NULL, *pk2 = NULL, *pk3 = NULL; routerinfo_t *rp1 = NULL, *rp2 = NULL; addr_policy_t *ex1, *ex2; @@ -2885,8 +2885,6 @@ test_dir_format(void) if (rp2) routerinfo_free(rp2); tor_free(dir1); /* XXXX And more !*/ tor_free(dir2); /* And more !*/ - routerinfo_free(r1); - routerinfo_free(r2); /* Try out version parsing functionality */ test_eq(0, tor_version_parse("0.3.4pre2-cvs", &ver1)); @@ -2982,7 +2980,10 @@ test_dir_format(void) test_eq(1, tor_version_as_new_as("Tor 0.2.1.1", "Tor 0.2.1.0-dev (r99)")); done: - ; + if (r1) + routerinfo_free(r1); + if (r2) + routerinfo_free(r2); } extern const char AUTHORITY_CERT_1[]; |