handle_wrap: fix NULL pointer dereference
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 16 Apr 2013 20:59:35 +0000 (22:59 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 16 Apr 2013 21:11:03 +0000 (23:11 +0200)
commitccd37226c6d337ea8ce3c0f9b7ddd1bd7eeaec1f
treea83a6627265a5c68ac61f67e760213e36a231d0d
parent7592615aaa1eb7a18dca1b9ab70865bbfd99a80d
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.)
src/handle_wrap.cc
test/simple/test-stdout-close-unref.js [new file with mode: 0644]