Skip to content

Commit c6fd2c5

Browse files
committed
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"
1 parent 77f3586 commit c6fd2c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/buffer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ function Buffer(subject, encoding) {
8484
var prevLen = this.length;
8585
this.length = len;
8686
truncate(this, this.length);
87-
poolOffset -= (prevLen - len);
87+
// Only need to readjust the poolOffset if the allocation is a slice.
88+
if (this.parent != undefined)
89+
poolOffset -= (prevLen - len);
8890
}
8991

9092
} else if (subject instanceof Buffer) {

0 commit comments

Comments
 (0)