aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 871b34b11..1c658278b 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -869,18 +869,21 @@ router_add_exit_policy_from_string(routerinfo_t *router, const char *s)
tmp[len+1]='\0';
if (router_get_next_token(&cp, &tok)) {
log_fn(LOG_WARN, "Error reading exit policy: %s", tok.val.error);
- free(tmp);
- return -1;
+ goto err;
}
if (tok.tp != K_ACCEPT && tok.tp != K_REJECT) {
log_fn(LOG_WARN, "Expected 'accept' or 'reject'.");
- free(tmp);
- return -1;
+ goto err;
}
/* Now that we've gotten an exit policy, add it to the router. */
r = router_add_exit_policy(router, &tok);
+ goto done;
+ err:
+ r = -1;
+ done:
free(tmp);
+ router_release_token(&tok);
return r;
}