aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2018-06-23 03:24:10 +0200
committerAlexander Færøy <ahf@torproject.org>2018-06-23 13:10:29 +0200
commitdcbfee246f35970f65d08a4555e25b956b9aba9c (patch)
treea68b040e62ac62103416337b5775cd2554d5e2de
parent1724f995c71502977c79343922ab50fc2403284f (diff)
downloadtor-dcbfee246f35970f65d08a4555e25b956b9aba9c.tar.gz
tor-dcbfee246f35970f65d08a4555e25b956b9aba9c.zip
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.
-rw-r--r--src/or/routerlist.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f21a222cd2..f73ec9baa1 100644
--- 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);
}