[Pkg-javascript-commits] [node-leveldown] 01/23: Fix leak of options attributes.
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:21:52 UTC 2014
This is an automated email from the git hooks/post-receive script.
andrewrk-guest pushed a commit to tag hyper-0.10.2
in repository node-leveldown.
commit df782b6da09cd2d1e65ed4c98c8ce1ae871eff79
Author: Geoff Greer <geoff at greer.fm>
Date: Tue Jan 14 16:14:19 2014 -0800
Fix leak of options attributes.
---
src/database.cc | 11 +++++++++++
src/database.h | 1 +
src/database_async.cc | 1 -
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/database.cc b/src/database.cc
index b96da74..31c9450 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -8,6 +8,7 @@
#include <node_buffer.h>
#include "leveldb/db.h"
+#include "leveldb/filter_policy.h"
#include "leveldb/write_batch.h"
#include "leveldown.h"
@@ -41,6 +42,7 @@ leveldb::Status Database::OpenDatabase (
leveldb::Options* options
, std::string location
) {
+ openOptions = options;
return leveldb::DB::Open(*options, location, &db);
}
@@ -115,6 +117,15 @@ void Database::ReleaseIterator (uint32_t id) {
void Database::CloseDatabase () {
delete db;
db = NULL;
+ if (openOptions->block_cache) {
+ delete openOptions->block_cache;
+ openOptions->block_cache = NULL;
+ }
+ if (openOptions->filter_policy) {
+ delete openOptions->filter_policy;
+ openOptions->filter_policy = NULL;
+ }
+ delete openOptions;
}
/* V8 exposed functions *****************************/
diff --git a/src/database.h b/src/database.h
index 2310f83..21bd8ac 100644
--- a/src/database.h
+++ b/src/database.h
@@ -78,6 +78,7 @@ public:
private:
leveldb::DB* db;
+ leveldb::Options* openOptions;
char* location;
uint32_t currentIteratorId;
void(*pendingCloseWorker);
diff --git a/src/database_async.cc b/src/database_async.cc
index 5c7cd03..394cd05 100644
--- a/src/database_async.cc
+++ b/src/database_async.cc
@@ -46,7 +46,6 @@ OpenWorker::OpenWorker (
};
OpenWorker::~OpenWorker () {
- delete options;
}
void OpenWorker::Execute () {
--
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