Merge commit 'origin/maint-0.2.1'

This commit is contained in:
Nick Mathewson 2009-05-17 00:05:38 -04:00
commit e563874045
2 changed files with 12 additions and 2 deletions

View File

@ -30,6 +30,12 @@ Changes in version 0.2.1.15??? - ????-??-??
directory authority. Fixes part of bug 932.
- When we change to or from being a bridge, reset our counts of
client usage by country. Fixes bug 932.
- Fix a bug that made stream bandwidth get misreported to the
controller.
- Fix an assertion failure on 64-bit platforms when we allocated
memory right up to the end of a memarea, then realigned the
memory one step beyond the end. Fixes a possible cause of bug
930.
Changes in version 0.2.1.14-rc - 2009-04-12

View File

@ -211,6 +211,8 @@ memarea_alloc(memarea_t *area, size_t sz)
char *result;
tor_assert(chunk);
CHECK_SENTINEL(chunk);
if (sz == 0)
sz = 1;
if (chunk->next_mem+sz > chunk->u.mem+chunk->mem_size) {
if (sz+CHUNK_HEADER_SIZE >= CHUNK_SIZE) {
/* This allocation is too big. Stick it in a special chunk, and put
@ -227,10 +229,11 @@ memarea_alloc(memarea_t *area, size_t sz)
tor_assert(chunk->mem_size >= sz);
}
result = chunk->next_mem;
chunk->next_mem = realign_pointer(chunk->next_mem + sz);
chunk->next_mem = chunk->next_mem + sz;
// XXXX021 remove these once bug 930 is solved.
tor_assert(chunk->next_mem >= chunk->u.mem);
tor_assert(chunk->next_mem <= chunk->u.mem+chunk->mem_size);
chunk->next_mem = realign_pointer(chunk->next_mem);
return result;
}
@ -303,7 +306,8 @@ memarea_assert_ok(memarea_t *area)
for (chunk = area->first; chunk; chunk = chunk->next_chunk) {
CHECK_SENTINEL(chunk);
tor_assert(chunk->next_mem >= chunk->u.mem);
tor_assert(chunk->next_mem <= chunk->u.mem+chunk->mem_size+MEMAREA_ALIGN);
tor_assert(chunk->next_mem <=
(char*) realign_pointer(chunk->u.mem+chunk->mem_size));
}
}