diff options
author | Roger Dingledine <arma@torproject.org> | 2005-06-09 03:57:54 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-06-09 03:57:54 +0000 |
commit | d922fa7b1015af58fe5fff19ab758f076f443cae (patch) | |
tree | 7dc1a863c1f98cd5785c3b5b0f7e245d0246a866 /src | |
parent | 2d7cbb71aa7633313ad63b5fcc04e876190d4b21 (diff) | |
download | tor-d922fa7b1015af58fe5fff19ab758f076f443cae.tar.gz tor-d922fa7b1015af58fe5fff19ab758f076f443cae.zip |
fix another underflow in keeping stats
these size_ts are subtle buggers
svn:r4364
Diffstat (limited to 'src')
-rw-r--r-- | src/or/buffers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 5a0ce6f47d..310fd57724 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -188,7 +188,8 @@ static void buf_resize(buf_t *buf, size_t new_capacity) SET_GUARDS(buf->mem, new_capacity); buf->cur = buf->mem+offset; } - buf_total_alloc += (new_capacity - buf->len); + buf_total_alloc += new_capacity; + buf_total_alloc -= buf->len; if (offset + buf->datalen > buf->len) { /* We need to move data now that we are done growing. The buffer @@ -673,7 +674,8 @@ write_to_buf(const char *string, size_t string_len, buf_t *buf) } if (buf->datalen > buf->highwater) buf->highwater = buf->datalen; - log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",(int)string_len, (int)buf->datalen); + log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).", + (int)string_len, (int)buf->datalen); check(); return buf->datalen; } |