]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix memory leak in protover.c
authorRoger Dingledine <arma@torproject.org>
Wed, 20 Jun 2018 23:43:58 +0000 (19:43 -0400)
committerRoger Dingledine <arma@torproject.org>
Wed, 20 Jun 2018 23:43:58 +0000 (19:43 -0400)
Fix a memory leak where directory authorities would leak a chunk of
memory for every router descriptor every time they considered voting.

This bug was taking down directory authorities in the live network due
to out-of-memory issues.

Fixes bug 26435; bugfix on 0.3.3.6.

changes/bug26435 [new file with mode: 0644]
src/or/protover.c

diff --git a/changes/bug26435 b/changes/bug26435
new file mode 100644 (file)
index 0000000..c281949
--- /dev/null
@@ -0,0 +1,5 @@
+  o Major bugfixes:
+    - Fix a memory leak where directory authorities would leak a chunk
+      of memory for every router descriptor every time they considered
+      voting. This bug was taking down directory authorities due to
+      out-of-memory issues. Fixes bug 26435; bugfix on 0.3.3.6.
index b2ec3372c957c3abe00d17a17988bb1586a0ac1b..5145881ba96880f10f6357612e97991adea6f738 100644 (file)
@@ -283,9 +283,12 @@ parse_protocol_list(const char *s)
 bool
 protover_contains_long_protocol_names(const char *s)
 {
-  if (!parse_protocol_list(s))
-    return true;
-  return false;
+  smartlist_t *list = parse_protocol_list(s);
+  if (!list)
+    return true; /* yes, has a dangerous name */
+  SMARTLIST_FOREACH(list, proto_entry_t *, ent, proto_entry_free(ent));
+  smartlist_free(list);
+  return false; /* no, looks fine */
 }
 
 /**