r17405@catbus: nickm | 2007-12-26 22:27:37 -0500

And clean up an assertion failure.


svn:r12993
This commit is contained in:
Nick Mathewson 2007-12-27 03:27:48 +00:00
parent 148e2e1c48
commit 119b4e1edf

View File

@ -229,6 +229,7 @@ buf_shrink_freelists(int free_all)
int n_to_free = free_all ? freelists[i].cur_length : int n_to_free = free_all ? freelists[i].cur_length :
(freelists[i].lowest_length - slack); (freelists[i].lowest_length - slack);
int n_to_skip = freelists[i].cur_length - n_to_free; int n_to_skip = freelists[i].cur_length - n_to_free;
int new_length = n_to_skip;
chunk_t **chp = &freelists[i].head; chunk_t **chp = &freelists[i].head;
chunk_t *chunk; chunk_t *chunk;
log_info(LD_MM, "Cleaning freelist for %d-byte chunks: keeping %d, " log_info(LD_MM, "Cleaning freelist for %d-byte chunks: keeping %d, "
@ -248,7 +249,7 @@ buf_shrink_freelists(int free_all)
--n_to_free; --n_to_free;
} }
tor_assert(!n_to_free); tor_assert(!n_to_free);
freelists[i].cur_length = n_to_skip; freelists[i].cur_length = new_length;
} }
freelists[i].lowest_length = freelists[i].cur_length; freelists[i].lowest_length = freelists[i].cur_length;
assert_freelist_ok(&freelists[i]); assert_freelist_ok(&freelists[i]);