src: fix MakeCallback() handle leak
authorBen Noordhuis <info@bnoordhuis.nl>
Sat, 16 Nov 2013 19:05:42 +0000 (20:05 +0100)
committerTimothy J Fontaine <tjfontaine@gmail.com>
Wed, 5 Feb 2014 19:49:01 +0000 (11:49 -0800)
commit4dc6f4adf48e9b1d35ff88e30dfbdc016d6621f7
treed9ee2c1f76ce871b754558ccb5bdf44a5e777215
parent1f2f3fa83a93d7b21306f1fd0b1e1793cc3a5b2c
src: fix MakeCallback() handle leak

Create a new HandleScope before looking up the object context with
v8::Object::CreationContext(), else we leak the Local<Context> into
the current HandleScope.

That's relatively harmless unless the HandleScope is long-lived and
MakeCallback() is called a lot.  In a scenario like that, we may end
up leaking a lot of memory.

What is unfortunate about this change is that we're trying hard to
eradicate the node_isolate global.  Longer term, we will probably have
to change the MakeCallback() prototype to one that requires an explicit
v8::Isolate* argument.
src/node.cc