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

[or-cvs] free some more memory at shutdown



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

Modified Files:
	main.c rephist.c 
Log Message:
free some more memory at shutdown


Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.452
retrieving revision 1.453
diff -u -d -r1.452 -r1.453
--- main.c	27 Feb 2005 09:47:01 -0000	1.452
+++ main.c	28 Feb 2005 01:59:18 -0000	1.453
@@ -1265,6 +1265,8 @@
   tor_tls_free_all();
   /* stuff in main.c */
   smartlist_free(closeable_connection_lst);
+
+  close_logs(); /* free log strings. do this last so logs keep working. */
 }
 
 /** Do whatever cleanup is necessary before shutting Tor down. */

Index: rephist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/rephist.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- rephist.c	11 Feb 2005 01:26:47 -0000	1.54
+++ rephist.c	28 Feb 2005 01:59:18 -0000	1.55
@@ -640,6 +640,13 @@
   add_predicted_port(80, time(NULL)); /* add one to kickstart us */
 }
 
+static void predicted_ports_free(void) {
+  SMARTLIST_FOREACH(predicted_ports_list, char *, cp, tor_free(cp));
+  smartlist_free(predicted_ports_list);
+  SMARTLIST_FOREACH(predicted_ports_times, char *, cp, tor_free(cp));
+  smartlist_free(predicted_ports_times);
+}
+
 /** Remember that <b>port</b> has been asked for as of time <b>now</b>.
  * This is used for predicting what sorts of streams we'll make in the
  * future and making circuits to anticipate that.
@@ -736,4 +743,5 @@
   strmap_free(history_map, free_or_history);
   tor_free(read_array);
   tor_free(write_array);
+  predicted_ports_free();
 }