[or-cvs] r16449: {tor} Backport: Fix bug 794: recover 3 bytes wasted per memory chu (in tor/branches/tor-0_2_0-patches: . src/common)

nickm at seul.org nickm at seul.org
Wed Aug 6 16:22:36 UTC 2008


Author: nickm
Date: 2008-08-06 12:22:35 -0400 (Wed, 06 Aug 2008)
New Revision: 16449

Modified:
   tor/branches/tor-0_2_0-patches/
   tor/branches/tor-0_2_0-patches/ChangeLog
   tor/branches/tor-0_2_0-patches/src/common/mempool.c
Log:
 r17660 at tombo:  nickm | 2008-08-06 12:22:19 -0400
 Backport: Fix bug 794: recover 3 bytes wasted per memory chunk.  Fix from rovv.



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

Modified: tor/branches/tor-0_2_0-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_2_0-patches/ChangeLog	2008-08-06 16:22:32 UTC (rev 16448)
+++ tor/branches/tor-0_2_0-patches/ChangeLog	2008-08-06 16:22:35 UTC (rev 16449)
@@ -2,6 +2,8 @@
  o Minor bugfixes:
     - Fix a small alignment and memory-wasting bug on buffer chunks.  Spotted
       by rovv.
+    - Recover 3-7 bytes that were wasted per memory chunk.  Fixes bug
+      794; bug spotted by rovv.  Bugfix on 0.2.0.1-alpha.
 
 
 Changes in version 0.2.0.30 - 2008-07-15

Modified: tor/branches/tor-0_2_0-patches/src/common/mempool.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/common/mempool.c	2008-08-06 16:22:32 UTC (rev 16448)
+++ tor/branches/tor-0_2_0-patches/src/common/mempool.c	2008-08-06 16:22:35 UTC (rev 16449)
@@ -144,7 +144,7 @@
 };
 
 /** Number of extra bytes needed beyond mem_size to allocate a chunk. */
-#define CHUNK_OVERHEAD (sizeof(mp_chunk_t)-1)
+#define CHUNK_OVERHEAD STRUCT_OFFSET(mp_chunk_t, mem[0])
 
 /** Given a pointer to a mp_allocated_t, return a pointer to the memory
  * item it holds. */



More information about the tor-commits mailing list