Skip to content

Commit

Permalink
buffer: fix pool offset adjustment
Browse files Browse the repository at this point in the history
If the Buffer allocation isn't a slice then there's no need to adjust
the pool offset after realloc'ing the space available.

Fixes: 6462519 "buffer, doc: misc. fix and cleanup"
  • Loading branch information
trevnorris committed Feb 16, 2015
1 parent 6c3647c commit a35ba2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ function Buffer(subject, encoding) {
var prevLen = this.length;
this.length = len;
truncate(this, this.length);
poolOffset -= (prevLen - len);
// Only need to readjust the poolOffset if the allocation is a slice.
if (this.parent != undefined)
poolOffset -= (prevLen - len);
}

} else if (util.isBuffer(subject)) {
Expand Down

0 comments on commit a35ba2f

Please sign in to comment.