diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-04-16 22:59:35 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-04-16 23:11:03 +0200 |
commit | ccd37226c6d337ea8ce3c0f9b7ddd1bd7eeaec1f (patch) | |
tree | a83a6627265a5c68ac61f67e760213e36a231d0d /src/handle_wrap.cc | |
parent | 7592615aaa1eb7a18dca1b9ab70865bbfd99a80d (diff) | |
download | android-node-v8-ccd37226c6d337ea8ce3c0f9b7ddd1bd7eeaec1f.tar.gz android-node-v8-ccd37226c6d337ea8ce3c0f9b7ddd1bd7eeaec1f.tar.bz2 android-node-v8-ccd37226c6d337ea8ce3c0f9b7ddd1bd7eeaec1f.zip |
handle_wrap: fix NULL pointer dereference
Fix a NULL pointer dereference in src/handle_wrap.cc which is really a
use-after-close bug.
The test checks that unref() after close() works on process.stdout but
this bug affects everything that derives from HandleWrap. I discovered
it because child processes would sometimes quit for no reason (that is,
no reason until I turned on core dumps.)
Diffstat (limited to 'src/handle_wrap.cc')
-rw-r--r-- | src/handle_wrap.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 3f05c7d81b..a63421bc29 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -57,7 +57,7 @@ Handle<Value> HandleWrap::Ref(const Arguments& args) { UNWRAP_NO_ABORT(HandleWrap) - if (wrap) { + if (wrap != NULL && wrap->handle__ != NULL) { uv_ref(wrap->handle__); wrap->flags_ &= ~kUnref; } @@ -71,7 +71,7 @@ Handle<Value> HandleWrap::Unref(const Arguments& args) { UNWRAP_NO_ABORT(HandleWrap) - if (wrap) { + if (wrap != NULL && wrap->handle__ != NULL) { uv_unref(wrap->handle__); wrap->flags_ |= kUnref; } |