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

[or-cvs] r10046: Fix an assertion when we call tor_free_all before calling do (in tor/trunk: . src/or)



Author: nickm
Date: 2007-04-29 21:09:03 -0400 (Sun, 29 Apr 2007)
New Revision: 10046

Modified:
   tor/trunk/
   tor/trunk/src/or/relay.c
Log:
 r12544@catbus:  nickm | 2007-04-29 21:08:58 -0400
 Fix an assertion when we call tor_free_all before calling do_main_loop(). Discovered by weasel.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12544] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c	2007-04-29 20:15:53 UTC (rev 10045)
+++ tor/trunk/src/or/relay.c	2007-04-30 01:09:03 UTC (rev 10046)
@@ -1495,9 +1495,12 @@
 void
 free_cell_pool(void)
 {
-  tor_assert(cell_pool);
-  mp_pool_destroy(cell_pool);
-  cell_pool = NULL;
+  /* Maybe we haven't called init_cell_pool yet; need to check for it. */
+  if (cell_pool) {
+    tor_assert(cell_pool);
+    mp_pool_destroy(cell_pool);
+    cell_pool = NULL;
+  }
 }
 
 /** Free excess storage in cell pool. */