[or-cvs] r14392: Backport: Do not allocate excess space for named_flag and un (in tor/branches/tor-0_2_0-patches: . src/or)

nickm at seul.org nickm at seul.org
Thu Apr 17 20:23:25 UTC 2008


Author: nickm
Date: 2008-04-17 16:23:24 -0400 (Thu, 17 Apr 2008)
New Revision: 14392

Modified:
   tor/branches/tor-0_2_0-patches/
   tor/branches/tor-0_2_0-patches/ChangeLog
   tor/branches/tor-0_2_0-patches/src/or/dirvote.c
Log:
 r15239 at tombo:  nickm | 2008-04-17 16:22:50 -0400
 Backport: Do not allocate excess space for named_flag and unnamed_flag in dirvote.c.  Fixes bug 662.  Not a dangerous bug: sizeof(int*) is at least as big as sizeof(int) everywhere.



Property changes on: tor/branches/tor-0_2_0-patches
___________________________________________________________________
 svk:merge ticket from /tor/020 [r15239] on 49666b30-7950-49c5-bedf-9dc8f3168102

Modified: tor/branches/tor-0_2_0-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_2_0-patches/ChangeLog	2008-04-17 20:23:13 UTC (rev 14391)
+++ tor/branches/tor-0_2_0-patches/ChangeLog	2008-04-17 20:23:24 UTC (rev 14392)
@@ -21,6 +21,8 @@
     - Fix a dumb bug that was preventing us from knowing that we should
       preemptively build circuits to handle expected directory requests.
       Fixes bug 660. Bugfix on 0.1.2.x.
+    - Avoid allocating extra space when computing consensuses on
+      64-bit platforms.  Bug spotted by aakova.
 
 
 Changes in version 0.2.0.23-rc - 2008-03-24

Modified: tor/branches/tor-0_2_0-patches/src/or/dirvote.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/dirvote.c	2008-04-17 20:23:13 UTC (rev 14391)
+++ tor/branches/tor-0_2_0-patches/src/or/dirvote.c	2008-04-17 20:23:24 UTC (rev 14392)
@@ -641,8 +641,8 @@
     n_voter_flags = tor_malloc_zero(sizeof(int) * smartlist_len(votes));
     n_flag_voters = tor_malloc_zero(sizeof(int) * smartlist_len(flags));
     flag_map = tor_malloc_zero(sizeof(int*) * smartlist_len(votes));
-    named_flag = tor_malloc_zero(sizeof(int*) * smartlist_len(votes));
-    unnamed_flag = tor_malloc_zero(sizeof(int*) * smartlist_len(votes));
+    named_flag = tor_malloc_zero(sizeof(int) * smartlist_len(votes));
+    unnamed_flag = tor_malloc_zero(sizeof(int) * smartlist_len(votes));
     for (i = 0; i < smartlist_len(votes); ++i)
       unnamed_flag[i] = named_flag[i] = -1;
     chosen_named_idx = smartlist_string_pos(flags, "Named");



More information about the tor-commits mailing list