Skip to content
This repository was archived by the owner on Jan 27, 2018. It is now read-only.

Commit

Permalink
clear node buffers of garbage when creating new Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Feb 19, 2013
1 parent b020278 commit d085132
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function BitField(data){
if(typeof data === "number"){
if(data % 8 !== 0) data += 1 << 3;
data = new Container(data >> 3);
if(data.fill) data.fill(0); // clear node buffers of garbage
}
this.buffer = data;
}
Expand All @@ -25,4 +26,4 @@ BitField.prototype.set = function(i, b){
}
};

if(typeof module !== "undefined") module.exports = BitField;
if(typeof module !== "undefined") module.exports = BitField;

0 comments on commit d085132

Please sign in to comment.