Skip to content

Commit

Permalink
Merge pull request #61 from Level/iterator-memleak-1
Browse files Browse the repository at this point in the history
Iterator memleak 1 from Level/leveldown#264
  • Loading branch information
ralphtheninja committed Jun 19, 2018
2 parents d067069 + 5d3553c commit 06e39e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace leveldown {
NAN_INLINE bool BooleanOptionValue(v8::Local<v8::Object> options,
const char* _key,
bool def = false) {
Nan::HandleScope scope;
v8::Local<v8::String> key = Nan::New(_key).ToLocalChecked();
return !options.IsEmpty()
&& options->Has(key)
Expand All @@ -23,6 +24,7 @@ NAN_INLINE bool BooleanOptionValue(v8::Local<v8::Object> options,
NAN_INLINE uint32_t UInt32OptionValue(v8::Local<v8::Object> options,
const char* _key,
uint32_t def) {
Nan::HandleScope scope;
v8::Local<v8::String> key = Nan::New(_key).ToLocalChecked();
return !options.IsEmpty()
&& options->Has(key)
Expand Down
8 changes: 8 additions & 0 deletions src/iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ Iterator::~Iterator () {
delete start;
if (end != NULL)
delete end;
if (lt != NULL)
delete lt;
if (gt != NULL)
delete gt;
if (lte != NULL)
delete lte;
if (gte != NULL)
delete gte;
};

bool Iterator::GetIterator () {
Expand Down
1 change: 1 addition & 0 deletions src/iterator_async.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void NextWorker::Execute () {
}

void NextWorker::HandleOKCallback () {
Nan::HandleScope scope;
size_t idx = 0;

size_t arraySize = result.size() * 2;
Expand Down

0 comments on commit 06e39e9

Please sign in to comment.