mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
stop segfault when choose_good_exit_server returns NULL
svn:r879
This commit is contained in:
parent
5a894a1595
commit
99db996aef
1 changed files with 6 additions and 2 deletions
|
@ -386,14 +386,18 @@ cpath_build_state_t *onion_new_cpath_build_state(void) {
|
||||||
directory_t *dir;
|
directory_t *dir;
|
||||||
int r;
|
int r;
|
||||||
cpath_build_state_t *info;
|
cpath_build_state_t *info;
|
||||||
|
routerinfo_t *exit;
|
||||||
|
|
||||||
router_get_directory(&dir);
|
router_get_directory(&dir);
|
||||||
r = new_route_len(options.PathlenCoinWeight, dir->routers, dir->n_routers);
|
r = new_route_len(options.PathlenCoinWeight, dir->routers, dir->n_routers);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
exit = choose_good_exit_server(dir);
|
||||||
|
if(!exit)
|
||||||
|
return NULL;
|
||||||
info = tor_malloc(sizeof(cpath_build_state_t));
|
info = tor_malloc(sizeof(cpath_build_state_t));
|
||||||
info->desired_path_len = r;
|
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;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue