diff options
| author | Brian Anderson <andersrb@gmail.com> | 2011-01-07 21:29:32 -0500 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-01-10 11:31:32 -0800 |
| commit | 04056d89c831767f3c71a0cc274e7c17b5721734 (patch) | |
| tree | 1b82e86ead3fa0089c2e17729390beb133435262 /src/rt/circular_buffer.cpp | |
| parent | 32c1c9f55c7a5575aa462bcec9e00cd11273841a (diff) | |
| download | rust-04056d89c831767f3c71a0cc274e7c17b5721734.tar.gz rust-04056d89c831767f3c71a0cc274e7c17b5721734.zip | |
Fix the check for growing the circular_buffer
Diffstat (limited to 'src/rt/circular_buffer.cpp')
| -rw-r--r-- | src/rt/circular_buffer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rt/circular_buffer.cpp b/src/rt/circular_buffer.cpp index bdf251248cd..77509abb069 100644 --- a/src/rt/circular_buffer.cpp +++ b/src/rt/circular_buffer.cpp @@ -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); |
