diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-30 09:35:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-30 09:35:59 +0000 |
commit | 32be2ae62aaf7b8eb5621f68be507088410781de (patch) | |
tree | af17269598324d841908d400acb298cd94c3fef6 /javaunohelper | |
parent | f69067fd66d898cca072ce91c2a04adc794378f0 (diff) |
coverity#705665 osl_Module->osl::Module
and
coverity#705666 Resource leak
still actually fails to dlclose module, but explicitly does that
Change-Id: Idbf5608b052e3a7c5a465a73d8ad067a0a9494c5
Diffstat (limited to 'javaunohelper')
-rw-r--r-- | javaunohelper/source/javaunohelper.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/javaunohelper/source/javaunohelper.cxx b/javaunohelper/source/javaunohelper.cxx index 54d286451379..05ad4c0c9591 100644 --- a/javaunohelper/source/javaunohelper.cxx +++ b/javaunohelper/source/javaunohelper.cxx @@ -20,7 +20,7 @@ #include "sal/config.h" #include <osl/diagnose.h> -#include <osl/module.h> +#include <osl/module.hxx> #include <uno/environment.hxx> #include <uno/lbnames.h> @@ -65,13 +65,14 @@ jboolean Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo( fprintf(stderr, "Hmm, %s called for %s\n", __PRETTY_FUNCTION__, OUStringToOString(pJLibName, RTL_TEXTENCODING_JAVA_UTF8).getStr()); #else - oslModule lib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); - if (lib) + osl::Module lib(aLibName, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL); + if (lib.is()) { + lib.release(); + // ========================= LATEST VERSION ========================= OUString aGetEnvName( COMPONENT_GETENV ); - oslGenericFunction pSym = - osl_getFunctionSymbol( lib, aGetEnvName.pData ); + oslGenericFunction pSym = lib.getFunctionSymbol(aGetEnvName); if (pSym) { Environment java_env, loader_env; @@ -93,7 +94,7 @@ jboolean Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo( (uno_Environment **)&java_env, java_env_name.pData, vm_access.get() ); OUString aWriteInfoName( COMPONENT_WRITEINFO ); - pSym = osl_getFunctionSymbol( lib, aWriteInfoName.pData ); + pSym = lib.getFunctionSymbol(aWriteInfoName); if (pSym) { if (loader_env.is() && java_env.is()) @@ -157,13 +158,14 @@ jobject Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory( jobject joSLL_cpp = 0; #ifndef DISABLE_DYNLOADING - oslModule lib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); - if (lib) + osl::Module lib(aLibName, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL); + if (lib.is()) { + lib.release(); + // ========================= LATEST VERSION ========================= OUString aGetEnvName( COMPONENT_GETENV ); - oslGenericFunction pSym = - osl_getFunctionSymbol( lib, aGetEnvName.pData ); + oslGenericFunction pSym = lib.getFunctionSymbol(aGetEnvName); if (pSym) { Environment java_env, loader_env; @@ -186,7 +188,7 @@ jobject Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory( (uno_Environment **)&java_env, java_env_name.pData, vm_access.get() ); OUString aGetFactoryName( COMPONENT_GETFACTORY ); - pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData ); + pSym = lib.getFunctionSymbol(aGetFactoryName); if (pSym) { if (loader_env.is() && java_env.is()) |