From: Trevor Norris Date: Mon, 16 Feb 2015 21:09:50 +0000 (-0700) Subject: buffer: fix pool offset adjustment X-Git-Tag: v1.3.0~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6fd2c5e95350c4aece2300f77b3942d8fd55daa;p=platform%2Fupstream%2Fnodejs.git buffer: fix pool offset adjustment 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" --- diff --git a/lib/buffer.js b/lib/buffer.js index 3e69090..bb30475 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -84,7 +84,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 (subject instanceof Buffer) {