Fix the check for growing the circular_buffer

This commit is contained in:
Brian Anderson
2011-01-07 21:29:32 -05:00
committed by Graydon Hoare
parent 32c1c9f55c
commit 04056d89c8
2 changed files with 15 additions and 1 deletions

View File

@@ -62,7 +62,7 @@ circular_buffer::enqueue(void *src) {
I(dom, _unread <= _buffer_sz);
// Grow if necessary.
if (_unread == _buffer_sz) {
if (_unread + unit_sz > _buffer_sz) {
size_t new_buffer_sz = _buffer_sz << 1;
I(dom, new_buffer_sz <= MAX_CIRCULAR_BUFFFER_SIZE);
void *new_buffer = dom->malloc(new_buffer_sz);