[or-cvs] r8564: Backport 8499: remove dangerous free(0) on hashtable init (in tor/branches/tor-0_1_1-patches: . src/common)

nickm at seul.org nickm at seul.org
Sun Oct 1 18:22:22 UTC 2006


Author: nickm
Date: 2006-10-01 14:22:22 -0400 (Sun, 01 Oct 2006)
New Revision: 8564

Modified:
   tor/branches/tor-0_1_1-patches/ChangeLog
   tor/branches/tor-0_1_1-patches/src/common/ht.h
Log:
Backport 8499: remove dangerous free(0) on hashtable init

Modified: tor/branches/tor-0_1_1-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_1-patches/ChangeLog	2006-10-01 18:16:48 UTC (rev 8563)
+++ tor/branches/tor-0_1_1-patches/ChangeLog	2006-10-01 18:22:22 UTC (rev 8564)
@@ -4,7 +4,12 @@
       and we have a cached answer, give them the cached answer.
       Previously, we would give them no answer at all.
 
+  o Minor bugfixes:
+    - Avoid a memory corruption bug when creating a hash table for the first
+      time.
 
+
+
 Changes in version 0.1.1.24 - 2006-09-29
   o Major bugfixes:
     - Allow really slow clients to not hang up five minutes into their

Modified: tor/branches/tor-0_1_1-patches/src/common/ht.h
===================================================================
--- tor/branches/tor-0_1_1-patches/src/common/ht.h	2006-10-01 18:16:48 UTC (rev 8563)
+++ tor/branches/tor-0_1_1-patches/src/common/ht.h	2006-10-01 18:22:22 UTC (rev 8564)
@@ -379,7 +379,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