Skip to content

Commit

Permalink
Merge branch 'maint-0.3.1' into release-0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Jun 29, 2018
2 parents d136e91 + ea14d34 commit fc52428
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changes/ticket26467
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions src/or/directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3499,6 +3499,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. */
}

Expand Down
1 change: 1 addition & 0 deletions src/or/hs_descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ decode_link_specifiers(const char *encoded)
sizeof(hs_spec->u.legacy_id));
break;
default:
tor_free(hs_spec);
goto err;
}

Expand Down
6 changes: 6 additions & 0 deletions src/test/hs_test_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,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;
}

Expand Down Expand Up @@ -139,6 +142,9 @@ hs_helper_build_hs_desc_impl(unsigned int no_ip,

descp = desc;
done:
if (descp == NULL)
tor_free(desc);

return descp;
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/test_channelpadding.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,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);
Expand Down
11 changes: 5 additions & 6 deletions src/test/test_hs_descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,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;

Expand All @@ -182,9 +185,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");
Expand All @@ -211,9 +212,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::]");
Expand Down Expand Up @@ -242,9 +241,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));
Expand All @@ -270,6 +267,8 @@ test_link_specifier(void *arg)
}

done:
link_specifier_free(ls);
tor_free(b64);
smartlist_free(link_specifiers);
}

Expand Down

0 comments on commit fc52428

Please sign in to comment.