[or-cvs] r8499: Backport candidate: remove dangerous free(0) on hashtable in (in tor/trunk: . src/common)

nickm at seul.org nickm at seul.org
Mon Sep 25 16:06:10 UTC 2006


Author: nickm
Date: 2006-09-25 12:06:09 -0400 (Mon, 25 Sep 2006)
New Revision: 8499

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/ht.h
Log:
Backport candidate: remove dangerous free(0) on hashtable init

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-09-25 15:44:40 UTC (rev 8498)
+++ tor/trunk/ChangeLog	2006-09-25 16:06:09 UTC (rev 8499)
@@ -53,6 +53,8 @@
     - If we're a directory mirror and we ask for "all" network status
       documents, we would discard status documents from authorities
       we don't recognize.
+    - Avoid a memory corruption bug when creating a hash table for the first
+      time.
 
   o Documentation
     - Documented (and renamed) ServerDNSSearchDomains and

Modified: tor/trunk/src/common/ht.h
===================================================================
--- tor/trunk/src/common/ht.h	2006-09-25 15:44:40 UTC (rev 8498)
+++ tor/trunk/src/common/ht.h	2006-09-25 16:06:09 UTC (rev 8499)
@@ -307,7 +307,8 @@
           elm = next;                                                   \
         }                                                               \
       }                                                                 \
-      freefn(head->hth_table);                                          \
+      if (head->hth_table)                                              \
+        freefn(head->hth_table);                                        \
       head->hth_table = new_table;                                      \
     } else {                                                            \
       unsigned b, b2;                                                   \



More information about the tor-commits mailing list