From: Ben Noordhuis Date: Fri, 5 Jul 2013 00:20:37 +0000 (+0200) Subject: src: fix memory leak in UsingDomains() X-Git-Tag: upstream/0.10.13~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=806e300878478db0a6f3c39762f35eed6aae0fe1;p=platform%2Fupstream%2Fnodejs.git src: fix memory leak in UsingDomains() UsingDomains() assigned process_tickCallback when it had already been set by MakeCallback() a few frames down the call stack. Dispose the handle first or we'll retain whatever is in the lexical closure of the old process._tickCallback function. Fixes #5795. --- diff --git a/src/node.cc b/src/node.cc index 9b27bfd..94af509 100644 --- a/src/node.cc +++ b/src/node.cc @@ -919,6 +919,7 @@ Handle UsingDomains(const Arguments& args) { Local ndt = ndt_v.As(); process->Set(String::New("_tickCallback"), tdc); process->Set(String::New("nextTick"), ndt); + process_tickCallback.Dispose(); // Possibly already set by MakeCallback(). process_tickCallback = Persistent::New(tdc); return Undefined(); }