buffer: don't CHECK on zero-sized realloc
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 23 Oct 2015 17:10:49 +0000 (19:10 +0200)
committerJames M Snell <jasnell@gmail.com>
Thu, 29 Oct 2015 15:38:42 +0000 (08:38 -0700)
commit2a45b72b4af505e46463928595b6f923bd40e1c6
tree2a2b68a2c8344603d12fc0bc4fb631685df58080
parentd409ac473b7ab9db96b3e67ac940fa0f8c74df90
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: https://github.com/nodejs/node/issues/3496
PR-URL: https://github.com/nodejs/node/pull/3499
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
src/node_buffer.cc
test/parallel/test-buffer.js