diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-01-30 20:59:15 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-01-30 20:59:15 +0000 |
commit | 88b579dd3317627b6fb61e6bcf7f18182145291f (patch) | |
tree | 1c3b807d001c56dbd0176343c5a3fb49ab8be655 /src/or/routerlist.c | |
parent | 6c3f55526a3d469c21dca8e9a7b8b512855174b1 (diff) | |
download | tor-88b579dd3317627b6fb61e6bcf7f18182145291f.tar.gz tor-88b579dd3317627b6fb61e6bcf7f18182145291f.zip |
Fix a bug that might have caused the leak, but which might have been hiding other bugs.
svn:r1026
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 3d5921d0e1..f07aac1b1a 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -695,7 +695,7 @@ routerinfo_t *router_get_entry_from_string(const char**s) { return NULL; } - NEXT_TOKEN(); + NEXT_TOKEN(); /* XXX This leaks some arguments. */ if (tok->tp != K_ROUTER) { log_fn(LOG_WARN,"Entry does not start with \"router\""); @@ -807,7 +807,7 @@ routerinfo_t *router_get_entry_from_string(const char**s) { NEXT_TOKEN(); while (tok->tp == K_ACCEPT || tok->tp == K_REJECT) { router_add_exit_policy(router, tok); - NEXT_TOKEN(); + NEXT_TOKEN(); /* This also leaks some args. XXX */ } if (tok->tp != K_ROUTER_SIGNATURE) { @@ -1067,11 +1067,12 @@ _router_get_next_token(const char **s, directory_token_t *tok) { char *signature = NULL; int i, done; + /* Clear the token _first_, so that we can clear it safely. */ + router_release_token(tok); + tok->tp = _ERR; tok->val.error = ""; - router_release_token(tok); - *s = eat_whitespace(*s); if (!**s) { tok->tp = _EOF; |