[or-cvs] Make --hash-password not craash on exit.

Nick Mathewson nickm at seul.org
Wed Oct 12 19:08:50 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv21831/src/or

Modified Files:
	circuitbuild.c config.c connection_edge.c 
Log Message:
Make --hash-password not craash on exit.

Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- circuitbuild.c	4 Oct 2005 22:23:31 -0000	1.148
+++ circuitbuild.c	12 Oct 2005 19:08:48 -0000	1.149
@@ -1677,9 +1677,11 @@
 helper_nodes_free_all(void)
 {
   /* Don't call clear_helper_nodes(); that will flush our state change to disk */
-  SMARTLIST_FOREACH(helper_nodes, helper_node_t *, h, tor_free(h));
-  smartlist_free(helper_nodes);
-  helper_nodes = NULL;
+  if (helper_nodes) {
+    SMARTLIST_FOREACH(helper_nodes, helper_node_t *, h, tor_free(h));
+    smartlist_free(helper_nodes);
+    helper_nodes = NULL;
+  }
 }
 
 /** How long (in seconds) do we allow a helper node to be nonfunctional before

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.435
retrieving revision 1.436
diff -u -d -r1.435 -r1.436
--- config.c	12 Oct 2005 18:43:03 -0000	1.435
+++ config.c	12 Oct 2005 19:08:48 -0000	1.436
@@ -394,11 +394,19 @@
 void
 config_free_all(void)
 {
-  config_free(&options_format, global_options);
-  config_free(&state_format, global_state);
+  if (global_options) {
+    config_free(&options_format, global_options);
+    global_options = NULL;
+  }
+  if (global_state) {
+    config_free(&state_format, global_state);
+    global_state = NULL;
+  }
   tor_free(torrc_fname);
-  addr_policy_free(reachable_addr_policy);
-  reachable_addr_policy = NULL;
+  if (reachable_addr_policy) {
+    addr_policy_free(reachable_addr_policy);
+    reachable_addr_policy = NULL;
+  }
 }
 
 /** If options->SafeLogging is on, return a not very useful string,

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -d -r1.354 -r1.355
--- connection_edge.c	6 Oct 2005 04:33:40 -0000	1.354
+++ connection_edge.c	12 Oct 2005 19:08:48 -0000	1.355
@@ -556,9 +556,14 @@
 void
 addressmap_free_all(void)
 {
-  strmap_free(addressmap, addressmap_ent_free);
-  addressmap = NULL;
-  strmap_free(virtaddress_reversemap, addressmap_virtaddress_ent_free);
+  if (addressmap) {
+    strmap_free(addressmap, addressmap_ent_free);
+    addressmap = NULL;
+  }
+  if (virtaddress_reversemap) {
+    strmap_free(virtaddress_reversemap, addressmap_virtaddress_ent_free);
+    virtaddress_reversemap = NULL;
+  }
 }
 
 /** Look at address, and rewrite it until it doesn't want any



More information about the tor-commits mailing list