summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-29 13:06:15 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-29 13:06:15 -0400
commitf82f8179e65c5e0021da46fd24e4bd7d8126d8f7 (patch)
treecc0c924b2eb5ff9644aef4022cdbb966f28c7509
parentdf896ed6323f6f0493393f97e739501df8092e7f (diff)
parent68dfbd5ef433b830059baa08d48589518db05d22 (diff)
downloadtor-f82f8179e65c5e0021da46fd24e4bd7d8126d8f7.tar.gz
tor-f82f8179e65c5e0021da46fd24e4bd7d8126d8f7.zip
Merge branch 'maint-0.3.2' into maint-0.3.3
-rw-r--r--changes/ticket264673
-rw-r--r--src/or/directory.c1
-rw-r--r--src/or/hs_descriptor.c1
-rw-r--r--src/test/hs_test_helpers.c6
-rw-r--r--src/test/test_channelpadding.c2
-rw-r--r--src/test/test_hs_descriptor.c11
6 files changed, 18 insertions, 6 deletions
diff --git a/changes/ticket26467 b/changes/ticket26467
new file mode 100644
index 0000000000..45883786c2
--- /dev/null
+++ b/changes/ticket26467
@@ -0,0 +1,3 @@
+ o Minor bugfixes (memory, correctness):
+ - Fix a number of small memory leaks identified by coverity. Fixes
+ bug 26467; bugfix on numerous Tor versions.
diff --git a/src/or/directory.c b/src/or/directory.c
index 0004878cdb..8636f68410 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -3680,6 +3680,7 @@ client_likes_consensus(const struct consensus_cache_entry_t *ent,
int have = 0;
if (consensus_cache_entry_get_voter_id_digests(ent, voters) != 0) {
+ smartlist_free(voters);
return 1; // We don't know the voters; assume the client won't mind. */
}
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 52a58d926d..0298c37322 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -1125,6 +1125,7 @@ decode_link_specifiers(const char *encoded)
sizeof(hs_spec->u.ed25519_id));
break;
default:
+ tor_free(hs_spec);
goto err;
}
diff --git a/src/test/hs_test_helpers.c b/src/test/hs_test_helpers.c
index 9355971267..5c1b9123d8 100644
--- a/src/test/hs_test_helpers.c
+++ b/src/test/hs_test_helpers.c
@@ -86,6 +86,9 @@ hs_helper_build_intro_point(const ed25519_keypair_t *signing_kp, time_t now,
intro_point = ip;
done:
+ if (intro_point == NULL)
+ tor_free(ip);
+
return intro_point;
}
@@ -143,6 +146,9 @@ hs_helper_build_hs_desc_impl(unsigned int no_ip,
descp = desc;
done:
+ if (descp == NULL)
+ tor_free(desc);
+
return descp;
}
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 9e570b81a7..740368f218 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -769,6 +769,8 @@ test_channelpadding_consensus(void *arg)
tt_i64_op(val, OP_LE, 24*60*60*2);
done:
+ tor_free(relay);
+
free_mock_consensus();
free_fake_channeltls((channel_tls_t*)chan);
smartlist_free(connection_array);
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 8e9d461c40..045696b40b 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -174,6 +174,9 @@ test_link_specifier(void *arg)
ssize_t ret;
hs_desc_link_specifier_t spec;
smartlist_t *link_specifiers = smartlist_new();
+ char buf[256];
+ char *b64 = NULL;
+ link_specifier_t *ls = NULL;
(void) arg;
@@ -183,9 +186,7 @@ test_link_specifier(void *arg)
/* Test IPv4 for starter. */
{
- char *b64, buf[256];
uint32_t ipv4;
- link_specifier_t *ls;
spec.type = LS_IPV4;
ret = tor_addr_parse(&spec.u.ap.addr, "1.2.3.4");
@@ -212,9 +213,7 @@ test_link_specifier(void *arg)
/* Test IPv6. */
{
- char *b64, buf[256];
uint8_t ipv6[16];
- link_specifier_t *ls;
spec.type = LS_IPV6;
ret = tor_addr_parse(&spec.u.ap.addr, "[1:2:3:4::]");
@@ -244,9 +243,7 @@ test_link_specifier(void *arg)
/* Test legacy. */
{
- char *b64, buf[256];
uint8_t *id;
- link_specifier_t *ls;
spec.type = LS_LEGACY_ID;
memset(spec.u.legacy_id, 'Y', sizeof(spec.u.legacy_id));
@@ -272,6 +269,8 @@ test_link_specifier(void *arg)
}
done:
+ link_specifier_free(ls);
+ tor_free(b64);
smartlist_free(link_specifiers);
}