Commit df36256d by Martin Thierer

Fix leak in complete() callback of Database.each()

Add destructor to EachBaton that disposes the `completed` callback function.
parent ec4ef5ab
...@@ -122,10 +122,14 @@ public: ...@@ -122,10 +122,14 @@ public:
struct Async; struct Async;
struct EachBaton : Baton { struct EachBaton : Baton {
EachBaton(Statement* stmt_, Handle<Function> cb_) :
Baton(stmt_, cb_) {}
Persistent<Function> completed; Persistent<Function> completed;
Async* async; // Isn't deleted when the baton is deleted. Async* async; // Isn't deleted when the baton is deleted.
EachBaton(Statement* stmt_, Handle<Function> cb_) :
Baton(stmt_, cb_) {}
virtual ~EachBaton() {
NanDisposePersistent(completed);
}
}; };
struct PrepareBaton : Database::Baton { struct PrepareBaton : Database::Baton {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment