[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/maint-0.3.1] Fix memory leak in frac_nodes_with_descriptors().



commit dcbfee246f35970f65d08a4555e25b956b9aba9c
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Sat Jun 23 03:24:10 2018 +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.
---
 src/or/routerlist.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f21a222cd..f73ec9baa 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);
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits