[Pkg-javascript-commits] [node-leveldown] 204/492: memory leak, Persistent callback not Disposed

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit ce594886cef1e56764c5d722b9ded4cad34b92d0
Author: Rod Vagg <rod at vagg.org>
Date:   Fri Feb 15 17:51:48 2013 +1100

    memory leak, Persistent callback not Disposed
---
 src/iterator.cc       | 4 ++--
 src/iterator_async.cc | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/iterator.cc b/src/iterator.cc
index 797c6b9..7c90e5b 100644
--- a/src/iterator.cc
+++ b/src/iterator.cc
@@ -108,10 +108,10 @@ Handle<Value> levelup::Iterator::End (const Arguments& args) {
     THROW_RETURN("end() already called on iterator")
   }
 
-  Persistent<Function> endCallback = Persistent<Function>::New(Local<Function>::Cast(args[0]));
+  Persistent<Function> callback = Persistent<Function>::New(Local<Function>::Cast(args[0]));
   EndWorker* worker = new EndWorker(
       iterator
-    , endCallback
+    , callback
   );
   iterator->ended = true;
   if (iterator->nexting) {
diff --git a/src/iterator_async.cc b/src/iterator_async.cc
index 5148e33..dd9da76 100644
--- a/src/iterator_async.cc
+++ b/src/iterator_async.cc
@@ -29,7 +29,9 @@ NextWorker::NextWorker (
   , localCallback(localCallback)
 {};
 
-NextWorker::~NextWorker () {}
+NextWorker::~NextWorker () {
+  endCallback.Dispose();
+}
 
 void NextWorker::Execute () {
   ok = iterator->IteratorNext(key, value);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list