Skip to content

Commit

Permalink
Use Buffer.alloc(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Jan 12, 2018
1 parent c9a20e8 commit bf1fd79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ function memLoad (runState, offset, length) {

// shortcut
if (length.isZero()) {
return Buffer.from('')
return Buffer.alloc(0)
}

// NOTE: in theory this could overflow, but unlikely due to OOG above
Expand Down Expand Up @@ -1023,7 +1023,7 @@ function makeCall (runState, callOptions, localOpts, cb) {
callOptions.depth = runState.depth + 1

// empty the return data buffer
runState.lastReturned = Buffer.from([])
runState.lastReturned = Buffer.alloc(0)

// check if account has enough ether
// Note: in the case of delegatecall, the value is persisted and doesn't need to be deducted again
Expand Down
2 changes: 1 addition & 1 deletion lib/runCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ module.exports = function (opts, cb) {
if (totalGas.lte(gasLimit) && results.return.length <= 24576) {
results.gasUsed = totalGas
} else {
results.return = Buffer.from([])
results.return = Buffer.alloc(0)
// since Homestead
results.exception = 0
err = results.exceptionError = ERROR.OUT_OF_GAS
Expand Down

0 comments on commit bf1fd79

Please sign in to comment.