tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit dcbfee246f35970f65d08a4555e25b956b9aba9c
parent 1724f995c71502977c79343922ab50fc2403284f
Author: Alexander Færøy <ahf@torproject.org>
Date:   Sat, 23 Jun 2018 03:24:10 +0200

Fix memory leak in frac_nodes_with_descriptors().

This patch fixes a memory leak in frac_nodes_with_descriptors() where
we might return without free'ing the bandwidths variable.

See: Coverity CID 1437451.

Diffstat:
Msrc/or/routerlist.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/or/routerlist.c b/src/or/routerlist.c @@ -2765,6 +2765,8 @@ frac_nodes_with_descriptors(const smartlist_t *sl, if (node_has_descriptor(node)) n_with_descs++; }); + + tor_free(bandwidths); return ((double)n_with_descs) / (double)smartlist_len(sl); }