aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-12-03 10:04:44 +0000
committerRoger Dingledine <arma@torproject.org>2003-12-03 10:04:44 +0000
commit99db996aeff89448dd3adac8c525c6e134d64301 (patch)
tree9cd12653206e8a92108caf038e9bfaef55e6557d
parent5a894a1595d7857f9106e186f0b91ceb0f62c965 (diff)
downloadtor-99db996aeff89448dd3adac8c525c6e134d64301.tar
tor-99db996aeff89448dd3adac8c525c6e134d64301.tar.gz
stop segfault when choose_good_exit_server returns NULL
svn:r879
-rw-r--r--src/or/onion.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index 4116557b1..0e5a5d5c0 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -386,14 +386,18 @@ cpath_build_state_t *onion_new_cpath_build_state(void) {
directory_t *dir;
int r;
cpath_build_state_t *info;
-
+ routerinfo_t *exit;
+
router_get_directory(&dir);
r = new_route_len(options.PathlenCoinWeight, dir->routers, dir->n_routers);
if (r < 0)
return NULL;
+ exit = choose_good_exit_server(dir);
+ if(!exit)
+ return NULL;
info = tor_malloc(sizeof(cpath_build_state_t));
info->desired_path_len = r;
- info->chosen_exit = tor_strdup(choose_good_exit_server(dir)->nickname);
+ info->chosen_exit = tor_strdup(exit->nickname);
return info;
}