summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/control.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index c04135d8d1..7d8aca3b98 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1512,14 +1512,13 @@ getinfo_helper_dir(control_connection_t *control_conn,
tor_free(url);
smartlist_free(descs);
} else if (!strcmpstart(question, "dir/status/")) {
- size_t len;
- char *cp;
if (get_options()->DirPort) {
+ size_t len=0;
+ char *cp;
smartlist_t *status_list = smartlist_create();
dirserv_get_networkstatus_v2(status_list,
question+strlen("dir/status/"));
SMARTLIST_FOREACH(status_list, cached_dir_t *, d, len += d->dir_len);
- len = 0;
cp = *answer = tor_malloc(len+1);
SMARTLIST_FOREACH(status_list, cached_dir_t *, d, {
memcpy(cp, d->dir, d->dir_len);