Commit 51e09d00 authored by Michael Dawson's avatar Michael Dawson Committed by Myles Borins
Browse files

src: normalize malloc, 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.

- Introduce node::malloc, node::realloc and node::calloc that should
  be used throught our source.
- Update all existing node source files to use the new functions
  instead of the native allocation functions.

Fixes: https://github.com/nodejs/node/issues/7549
PR-URL: https://github.com/nodejs/node/pull/7564


Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
parent 3b5cedeb
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment