diff options
author | Trevor Norris <trev.norris@gmail.com> | 2015-02-16 14:09:50 -0700 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2015-02-16 14:09:50 -0700 |
commit | c6fd2c5e95350c4aece2300f77b3942d8fd55daa (patch) | |
tree | 9d036a9aae1cea5ded4baf12bf3a5ccc4ddcc5b1 /lib/buffer.js | |
parent | 77f35861d0217273b9e478f5d35bd7d8e471e14f (diff) | |
download | nodejs-c6fd2c5e95350c4aece2300f77b3942d8fd55daa.tar.gz nodejs-c6fd2c5e95350c4aece2300f77b3942d8fd55daa.tar.bz2 nodejs-c6fd2c5e95350c4aece2300f77b3942d8fd55daa.zip |
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"
Diffstat (limited to 'lib/buffer.js')
-rw-r--r-- | lib/buffer.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/buffer.js b/lib/buffer.js index 3e690901e..bb3047579 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) { |