From 32be2ae62aaf7b8eb5621f68be507088410781de Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 30 Oct 2014 09:35:59 +0000 Subject: coverity#705665 osl_Module->osl::Module and coverity#705666 Resource leak still actually fails to dlclose module, but explicitly does that Change-Id: Idbf5608b052e3a7c5a465a73d8ad067a0a9494c5 --- javaunohelper/source/javaunohelper.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'javaunohelper') 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 -#include +#include #include #include @@ -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()) -- cgit