mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 15:10:48 +01:00
Fix resource leak in parse_consensus_request()
We were allocating diff_hash_in_url on some URLs, but not freeing it. Fixes CID 1409669. Bug not in any released Tor.
This commit is contained in:
parent
2ca827104d
commit
bbeba2412e
2 changed files with 5 additions and 2 deletions
|
@ -566,6 +566,7 @@ consdiffmgr_find_consensus(struct consensus_cache_entry_t **entry_out,
|
||||||
consensus_flavor_t flavor,
|
consensus_flavor_t flavor,
|
||||||
compress_method_t method)
|
compress_method_t method)
|
||||||
{
|
{
|
||||||
|
tor_assert(entry_out);
|
||||||
tor_assert((int)flavor < N_CONSENSUS_FLAVORS);
|
tor_assert((int)flavor < N_CONSENSUS_FLAVORS);
|
||||||
|
|
||||||
int pos = consensus_compression_method_pos(method);
|
int pos = consensus_compression_method_pos(method);
|
||||||
|
|
|
@ -3929,8 +3929,10 @@ parse_consensus_request(parsed_consensus_request_t *out,
|
||||||
uint8_t diff_from[DIGEST256_LEN];
|
uint8_t diff_from[DIGEST256_LEN];
|
||||||
out->diff_from_digests = smartlist_new();
|
out->diff_from_digests = smartlist_new();
|
||||||
out->diff_only = 1;
|
out->diff_only = 1;
|
||||||
if (!parse_one_diff_hash(diff_from, diff_hash_in_url, "URL",
|
int ok = !parse_one_diff_hash(diff_from, diff_hash_in_url, "URL",
|
||||||
"rejecting")) {
|
"rejecting");
|
||||||
|
tor_free(diff_hash_in_url);
|
||||||
|
if (ok) {
|
||||||
smartlist_add(out->diff_from_digests,
|
smartlist_add(out->diff_from_digests,
|
||||||
tor_memdup(diff_from, DIGEST256_LEN));
|
tor_memdup(diff_from, DIGEST256_LEN));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue