summaryrefslogtreecommitdiff
path: root/src/cares_wrap.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2016-04-29 12:26:35 -0600
committerTrevor Norris <trev.norris@gmail.com>2016-05-24 14:38:34 -0600
commit9dd5b93c42a2e693a6660a580cf67723d7b287c8 (patch)
tree46b3931cb82645cef802e8857dd84bd697a036c7 /src/cares_wrap.cc
parentddc19be6de1ba263d9c175b2760696e7b9918b25 (diff)
downloadandroid-node-v8-9dd5b93c42a2e693a6660a580cf67723d7b287c8.tar.gz
android-node-v8-9dd5b93c42a2e693a6660a580cf67723d7b287c8.tar.bz2
android-node-v8-9dd5b93c42a2e693a6660a580cf67723d7b287c8.zip
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.cc2
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();
}