buffer: do proper error propagation in addon methods
- Always fulfill the `MaybeLocal<>` contract by scheduling an exception when returning an empty value. This was previously inconsistent, with no way to know whether an exception was be scheduled or not in case of failure. - Make sure that memory is released exactly once in case of failure. Previously, some exit conditions would have leaked memory or attempted to free it multiple times. This should not really affect how `Buffer`s are created by addons in practice, due to the low frequency with which these errors would typically occur. PR-URL: https://github.com/nodejs/node/pull/23939 Reviewed-By:Refael Ackermann <refack@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Joyee Cheung <joyeec9h3@gmail.com>
parent
1c67e741
Please register or sign in to comment