[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8499: Backport candidate: remove dangerous free(0) on hashtable in (in tor/trunk: . src/common)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r8499: Backport candidate: remove dangerous free(0) on hashtable in (in tor/trunk: . src/common)
- From: nickm@xxxxxxxx
- Date: Mon, 25 Sep 2006 12:06:10 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 25 Sep 2006 12:06:18 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
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;                                                   \