diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-03-14 23:47:35 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-03-19 02:25:55 +0300 |
commit | 897cec43c67d036f631e0538a8172a5a8f759611 (patch) | |
tree | f665bdf34ba3e777e32e98bbb16252be953e4725 /src/node_stat_watcher.cc | |
parent | 9c9324768f07051a34ca84154caa476082727cca (diff) |
fs: fix memory leak in WriteString
In the async case, if the buffer was copied instead of being moved
then the buf will not get deleted after the request is done.
This was introduced when the FSReqWrap:: Ownership was
removed in 4b9ba9b, and ReleaseEarly was no longer called upon
destruction of FSReqWrap.
Create a custom Init function so we can use the MaybeStackBuffer in
the FSReqBase to copy the string in the async case. The data will
then get destructed when the FSReqBase is destructed.
Fixes: https://github.com/nodejs/node/issues/19356
PR-URL: https://github.com/nodejs/node/pull/19357
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_stat_watcher.cc')
0 files changed, 0 insertions, 0 deletions