summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-07-17 21:06:00 +0000
committerRoger Dingledine <arma@torproject.org>2005-07-17 21:06:00 +0000
commitfe7535c5e20fc832aaa5770d1abf6b423532bed1 (patch)
treebec833d4654b77a1410156a0d553a258b34a8bb6 /src/or/control.c
parent2cff73e7a4bf66dce0d539df351ec430f6bdc6fe (diff)
downloadtor-fe7535c5e20fc832aaa5770d1abf6b423532bed1.tar.gz
tor-fe7535c5e20fc832aaa5770d1abf6b423532bed1.zip
arguments in EXTENDCIRCUIT were reversed
and an error message was misleading and we were leaking memory on some errors more bugs remain svn:r4585
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/or/control.c b/src/or/control.c
index a0748a2fe2..876c4b26a5 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1383,25 +1383,26 @@ handle_control_extendcircuit(connection_t *conn, uint32_t len,
goto done;
}
}
- } else {
+ } else { /* v1 */
smartlist_t *args;
args = smartlist_create();
smartlist_split_string(args, body, " ",
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
if (smartlist_len(args)<2)
- connection_printf_to_buf(conn,"512 Missing argument to ATTACHSTREAM\r\n");
+ connection_printf_to_buf(conn,"512 Missing argument to EXTENDCIRCUIT\r\n");
- smartlist_split_string(router_nicknames, smartlist_get(args,0), ",", 0, 0);
- zero_circ = !strcmp("0", (char*)smartlist_get(args,1));
- if (!zero_circ && !(circ = get_circ(smartlist_get(args,1)))) {
+ zero_circ = !strcmp("0", (char*)smartlist_get(args,0));
+ if (!zero_circ && !(circ = get_circ(smartlist_get(args,0)))) {
connection_printf_to_buf(conn, "552 Unknown circuit \"%s\"\r\n",
- (char*)smartlist_get(args, 1));
+ (char*)smartlist_get(args, 0));
}
+ smartlist_split_string(router_nicknames, smartlist_get(args,1), ",", 0, 0);
SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
smartlist_free(args);
- if (!zero_circ && !circ)
- return 0;
+ if (!zero_circ && !circ) {
+ goto done;
+ }
}
routers = smartlist_create();
@@ -1468,7 +1469,8 @@ handle_control_extendcircuit(connection_t *conn, uint32_t len,
done:
SMARTLIST_FOREACH(router_nicknames, char *, n, tor_free(n));
smartlist_free(router_nicknames);
- smartlist_free(routers);
+ if (routers)
+ smartlist_free(routers);
return 0;
}