summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-01-30 20:33:04 +0000
committerRoger Dingledine <arma@torproject.org>2004-01-30 20:33:04 +0000
commit7651b09c8a3c1b2dd1ff94b93b8f2ecbbe953222 (patch)
tree929c21ffa1ddcbf5887353b4062100f88d0568f5
parentafdaff63ef6c81bdd7a1bec49b63e4571d5987b7 (diff)
downloadtor-7651b09c8a3c1b2dd1ff94b93b8f2ecbbe953222.tar.gz
tor-7651b09c8a3c1b2dd1ff94b93b8f2ecbbe953222.zip
finally locate the memory leak,
plus commit a patch that doesn't fix it (but doesn't hurt? i dunno) svn:r1024
-rw-r--r--src/or/routerlist.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f4eeb29e05..35ed5aa697 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -539,7 +539,7 @@ router_get_routerlist_from_directory_impl(const char *s, routerlist_t **dest,
TOK_IS(K_RUNNING_ROUTERS, "running-routers");
n_good_nicknames = N_ARGS;
memcpy(good_nickname_lst, ARGS, n_good_nicknames*sizeof(char *));
- N_ARGS = 0; /* Don't free the strings in good_nickname_lst. */
+ N_ARGS = 0; /* Don't free the strings in good_nickname_lst yet. */
/* Read the router list from s, advancing s up past the end of the last
* router. */
@@ -549,6 +549,9 @@ router_get_routerlist_from_directory_impl(const char *s, routerlist_t **dest,
log_fn(LOG_WARN, "Error reading routers from directory");
goto err;
}
+ for (i = 0; i < n_good_nicknames; ++i) {
+ tor_free(good_nickname_lst[i]); /* now free them */
+ }
new_dir->software_versions = versions; versions = NULL;
new_dir->published_on = published_on;
@@ -1142,6 +1145,7 @@ _router_get_next_token(const char **s, directory_token_t *tok) {
if (*next == '\n')
done = 1;
tok->val.cmd.args[i++] = tor_strndup(*s,next-*s);
+ /* XXX this line (the strndup) is the memory leak. */
*s = eat_whitespace_no_nl(next+1);
}
tok->val.cmd.n_args = i;