diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-15 09:38:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-12-15 12:30:42 +0000 |
commit | 78d35f281c33b9f62a5b7c8d20817ea822e1b0c8 (patch) | |
tree | ed8698af3aab7a99dde85e709b09a8518ebb8f81 /javaunohelper | |
parent | 8814eb4770403dc2c210feb3a3dd2b5078c27c59 (diff) |
silence coverity#705667 Resource leak
still leaks on usual success case of course
Change-Id: Ia6e0f61b5a08271c03690bbb1c0af59081bea663
Diffstat (limited to 'javaunohelper')
-rw-r--r-- | javaunohelper/source/preload.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/javaunohelper/source/preload.cxx b/javaunohelper/source/preload.cxx index 57c980a5f6d1..a4e9c2008a18 100644 --- a/javaunohelper/source/preload.cxx +++ b/javaunohelper/source/preload.cxx @@ -22,7 +22,7 @@ #include "jni.h" #include "rtl/ustring.hxx" -#include "osl/module.h" +#include "osl/module.hxx" #include "juhx-export-types.hxx" @@ -51,9 +51,8 @@ static bool inited_juhx( JNIEnv * jni_env ) if (s_inited) return true; OUString lib_name = SAL_DLLPREFIX "juhx" SAL_DLLEXTENSION; - oslModule hModule = - osl_loadModuleRelative( &thisModule, lib_name.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); - if (0 == hModule) + osl::Module aModule; + if (!aModule.loadRelative(&thisModule, lib_name, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL)) { jclass c = jni_env->FindClass( "java/lang/RuntimeException" ); jni_env->ThrowNew( @@ -64,16 +63,14 @@ static bool inited_juhx( JNIEnv * jni_env ) { OUString symbol = "Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo"; - s_writeInfo = (javaunohelper::detail::Func_writeInfo *)osl_getFunctionSymbol( - hModule, symbol.pData ); + s_writeInfo = (javaunohelper::detail::Func_writeInfo *)aModule.getFunctionSymbol(symbol); symbol = "Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory"; - s_getFactory = (javaunohelper::detail::Func_getFactory *)osl_getFunctionSymbol( - hModule, symbol.pData ); + s_getFactory = (javaunohelper::detail::Func_getFactory *)aModule.getFunctionSymbol(symbol); symbol = "Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap"; s_bootstrap = - (javaunohelper::detail::Func_bootstrap *)osl_getFunctionSymbol( hModule, symbol.pData ); + (javaunohelper::detail::Func_bootstrap *)aModule.getFunctionSymbol(symbol); if (0 == s_writeInfo || 0 == s_getFactory || @@ -84,6 +81,7 @@ static bool inited_juhx( JNIEnv * jni_env ) c, "error resolving symbols of " SAL_DLLPREFIX "juhx" SAL_DLLEXTENSION "!" ); return false; } + aModule.release(); } s_inited = true; return true; |