Skip to content

Commit

Permalink
in ref.alloc, are we gettign a null pointer from Buffer.alloc(0)?
Browse files Browse the repository at this point in the history
  • Loading branch information
btsimonh committed Oct 28, 2024
1 parent 4524014 commit aec0a22
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ exports.alloc = function alloc (_type, value) {
} else {
size = exports.sizeof.pointer;
}
// does Buffer.alloc(0) => null object?
if (!size) size = 1;
const buffer = Buffer.alloc(size);
buffer.type = type;
if (arguments.length >= 2) {
Expand Down

0 comments on commit aec0a22

Please sign in to comment.