summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2018-06-20 19:43:58 -0400
committerRoger Dingledine <arma@torproject.org>2018-06-20 19:43:58 -0400
commit7b1a3c51644891c4548ccdfd4e8d444cd91b91b0 (patch)
treeabc092986f47d881d26fecca0bc9499b82745249
parenta360bf287d8220ec2e4899c57ed47a2a91e3bcb9 (diff)
downloadtor-7b1a3c51644891c4548ccdfd4e8d444cd91b91b0.tar.gz
tor-7b1a3c51644891c4548ccdfd4e8d444cd91b91b0.zip
fix memory leak in protover.c
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.
-rw-r--r--changes/bug264355
-rw-r--r--src/or/protover.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/changes/bug26435 b/changes/bug26435
new file mode 100644
index 0000000000..c281949349
--- /dev/null
+++ b/changes/bug26435
@@ -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.
diff --git a/src/or/protover.c b/src/or/protover.c
index b2ec3372c9..5145881ba9 100644
--- a/src/or/protover.c
+++ b/src/or/protover.c
@@ -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 */
}
/**