Преглед на файлове

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.
Alexander Færøy преди 6 години
родител
ревизия
dcbfee246f
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      src/or/routerlist.c

+ 2 - 0
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);
   }