From: Roger Dingledine Date: Thu, 25 Oct 2007 13:18:37 +0000 (+0000) Subject: Stop leaking memory every time we parse a v3 certificate. Bugfix X-Git-Tag: tor-0.2.0.10-alpha~147 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f37185bf0b58dd10f3432319ada40d06d5b41f80;p=thirdparty%2Ftor.git Stop leaking memory every time we parse a v3 certificate. Bugfix on 0.2.0.1-alpha. svn:r12185 --- diff --git a/ChangeLog b/ChangeLog index 4d28788d14..6410fc0315 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Changes in version 0.2.0.10-alpha - 2007-1?-?? o Minor bugfixes: - Refuse to start if both ORPort and UseBridges are set. Bugfix on 0.2.0.x. + - Stop leaking memory every time we parse a v3 certificate. Bugfix + on 0.2.0.1-alpha. Changes in version 0.2.0.9-alpha - 2007-10-24 @@ -232,7 +234,7 @@ Changes in version 0.2.0.8-alpha - 2007-10-12 o Minor bugfixes (controller): - When sending a status event to the controller telling it that an - OR address is readable, set the port correctly. (Previously we + OR address is reachable, set the port correctly. (Previously we were reporting the dir port.) Bugfix on 0.1.2.x. o Minor bugfixes (v3 directory system): diff --git a/src/or/routerparse.c b/src/or/routerparse.c index a2ba0d27b8..02f666bc41 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1392,7 +1392,7 @@ authority_cert_parse_from_string(const char *s, const char **end_of_string) len = eos - s; tokens = smartlist_create(); - if (tokenize_string(s, eos, tokens, dir_key_certificate_table,0) < 0) { + if (tokenize_string(s, eos, tokens, dir_key_certificate_table, 0) < 0) { log_warn(LD_DIR, "Error tokenizing key certificate"); goto err; } @@ -1501,9 +1501,13 @@ authority_cert_parse_from_string(const char *s, const char **end_of_string) if (end_of_string) { *end_of_string = eat_whitespace(eos); } + SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t)); + smartlist_free(tokens); return cert; err: authority_cert_free(cert); + SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t)); + smartlist_free(tokens); return NULL; }