Skip to content

Commit ccb329b

Browse files
committed
Eliminate memory leak in sodaDatabase.openCollection()
1 parent a47ae62 commit ccb329b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/njsSodaCollection.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void njsSodaCollection::Init(Local<Object> target)
104104
NAN_METHOD(njsSodaCollection::New)
105105
{
106106
njsSodaCollection *coll = new njsSodaCollection();
107-
coll->Wrap (info.Holder());
107+
coll->Wrap(info.Holder());
108108
info.GetReturnValue().Set(info.Holder());
109109
}
110110

@@ -130,7 +130,6 @@ Local<Object> njsSodaCollection::CreateFromBaton(njsBaton *baton)
130130
coll->dpiSodaDbHandle = baton->dpiSodaDbHandle;
131131
coll->jsOracledb.Reset(baton->jsOracledb);
132132
baton->dpiSodaCollHandle = NULL;
133-
baton->dpiSodaDbHandle = NULL;
134133
return scope.Escape(obj);
135134
}
136135

src/njsSodaDatabase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class njsSodaDatabase : public njsCommon {
8484
static NAN_METHOD(CreateDocument);
8585

8686
bool IsValid() const { return ( true ); } // sodaDB never closes.
87-
njsErrorType GetInvalidErrorType () const { return errInvalidConnection ; }
87+
njsErrorType GetInvalidErrorType() const { return errSuccess; }
8888

8989
// Constructor
9090
njsSodaDatabase() : dpiSodaDbHandle(NULL) {}
@@ -95,6 +95,7 @@ class njsSodaDatabase : public njsCommon {
9595
dpiSodaDb_release(dpiSodaDbHandle);
9696
dpiSodaDbHandle = NULL;
9797
}
98+
jsOracledb.Reset();
9899
}
99100

100101
// Member variables

0 commit comments

Comments
 (0)