Explorar o código

Maybe fix #471. Compute the size of bitfields more correctly. Nick, please check.

svn:r10941
Peter Palfrader %!s(int64=18) %!d(string=hai) anos
pai
achega
49db52abe6
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/common/container.h

+ 1 - 1
src/common/container.h

@@ -282,7 +282,7 @@ typedef unsigned int bitarray_t;
 static INLINE bitarray_t *
 bitarray_init_zero(int n_bits)
 {
-  size_t sz = (n_bits+BITARRAY_MASK) & BITARRAY_MASK;
+  size_t sz = (n_bits+BITARRAY_MASK) / (1u << BITARRAY_SHIFT);
   return tor_malloc_zero(sz*sizeof(unsigned int));
 }
 /** Free the bit array <b>ba</b>. */