buffer: don't CHECK on zero-sized realloc · nodejs/node@2a45b72 · GitHub
Skip to content

Commit 2a45b72

Browse files
bnoordhuisjasnell
authored andcommitted
buffer: don't CHECK on zero-sized realloc
malloc(0) and realloc(ptr, 0) have implementation-defined behavior in that the standard allows them to either return a unique pointer or a nullptr for zero-sized allocation requests. Normalize by always using a nullptr. Fixes: #3496 PR-URL: #3499 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent d409ac4 commit 2a45b72

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

src/node_buffer.cc

Lines changed: 21 additions & 9 deletions

test/parallel/test-buffer.js

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)