0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

leak fix for new jni methods

This commit is contained in:
Eliot Horowitz 2008-09-18 09:42:14 -04:00
parent 8216dc63c5
commit 9ea5237869

View File

@ -300,7 +300,7 @@ int JavaJSImpl::scopeSetObject( jlong id , const char * field , JSObj * obj ){
_getEnv()->DeleteLocalRef( s1 );
if ( bb )
_getEnv()->DeleteLocalRef( bb );
return res;
}
@ -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