[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] stop segfault when choose_good_exit_server returns NULL



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	onion.c 
Log Message:
stop segfault when choose_good_exit_server returns NULL


Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- onion.c	3 Dec 2003 09:50:02 -0000	1.98
+++ onion.c	3 Dec 2003 10:04:44 -0000	1.99
@@ -386,14 +386,18 @@
   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;
 }