Skip to content

Commit

Permalink
leak fix for new jni methods
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Sep 18, 2008
1 parent 8216dc6 commit 9ea5237
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions db/javajs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ int JavaJSImpl::scopeSetObject( jlong id , const char * field , JSObj * obj ){
_getEnv()->DeleteLocalRef( s1 );
if ( bb )
_getEnv()->DeleteLocalRef( bb );

return res;
}

Expand All @@ -310,18 +310,22 @@ int JavaJSImpl::scopeInit( jlong id , JSObj * obj ){

jobject bb = _getEnv()->NewDirectByteBuffer( (void*)(obj->objdata()) , (jlong)(obj->objsize()) );
jassert( bb );

return _getEnv()->CallStaticBooleanMethod( _dbhook , _scopeInit , id , bb );

int res = _getEnv()->CallStaticBooleanMethod( _dbhook , _scopeInit , id , bb );
_getEnv()->DeleteLocalRef( bb );
return res;
}

int JavaJSImpl::scopeSetThis( jlong id , JSObj * obj ){
if ( ! obj )
return 0;

jobject bb = _getEnv()->NewDirectByteBuffer( (void*)(obj->objdata()) , (jlong)(obj->objsize()) );
jassert( bb );

return _getEnv()->CallStaticBooleanMethod( _dbhook , _scopeSetThis , id , bb );
int res = _getEnv()->CallStaticBooleanMethod( _dbhook , _scopeSetThis , id , bb );
_getEnv()->DeleteLocalRef( bb );
return res;
}

// scope getters
Expand Down

0 comments on commit 9ea5237

Please sign in to comment.