diff options
author | Trevor Norris <trev.norris@gmail.com> | 2016-04-29 12:26:35 -0600 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2016-06-02 22:39:22 +1000 |
commit | 4da3e1e461869414f80fc93b6122fe0f28791895 (patch) | |
tree | 9a3bb5a47895063feb24c5fff4ea9f2fa9a4769a /src/cares_wrap.cc | |
parent | 7e5775704e93c3e1910405be83f9451f74a5bd69 (diff) | |
download | node-new-4da3e1e461869414f80fc93b6122fe0f28791895.tar.gz |
src: always clear wrap before persistent Reset()
In case the handle is stored and accessed after the associated C++ class
was destructed, set the internal pointer to nullptr so any
getters/setters can return accordingly without aborting the application.
PR-URL: https://github.com/nodejs/node/pull/6184
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r-- | src/cares_wrap.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 6bd73ae3ba..91d139ac9c 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -9,6 +9,7 @@ #include "req-wrap-inl.h" #include "tree.h" #include "util.h" +#include "util-inl.h" #include "uv.h" #include <errno.h> @@ -258,6 +259,7 @@ class QueryWrap : public AsyncWrap { virtual ~QueryWrap() override { CHECK_EQ(false, persistent().IsEmpty()); + ClearWrap(object()); persistent().Reset(); } |