[Libreoffice-commits] core.git: javaunohelper/source
Caolán McNamara
caolanm at redhat.com
Wed Jan 7 02:18:50 PST 2015
javaunohelper/source/javaunohelper.cxx | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
New commits:
commit 8eda0f7b07f8fb09b11c577882b5cd4a548e1423
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 7 10:16:18 2015 +0000
WaE: -Werror=unused-variable with #define DISABLE_DYNLOADING
and also a leak in that mode with a missing ReleaseStringChars after
GetStringChars in one use, and a use after free in the other use where
ReleaseStringChars is called
Change-Id: I2da0310429daf8519554fd7aaf47bba9f6f0e85c
diff --git a/javaunohelper/source/javaunohelper.cxx b/javaunohelper/source/javaunohelper.cxx
index 05ad4c0..99a9252 100644
--- a/javaunohelper/source/javaunohelper.cxx
+++ b/javaunohelper/source/javaunohelper.cxx
@@ -54,16 +54,16 @@ jboolean Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo(
{
bool bRet = false;
- const jchar* pJLibName = pJEnv->GetStringChars( jLibName, NULL );
- OUString aLibName( pJLibName );
- pJEnv->ReleaseStringChars( jLibName, pJLibName);
+ const jchar* pJLibName = pJEnv->GetStringChars(jLibName, NULL);
+ OUString aLibName(pJLibName);
+ pJEnv->ReleaseStringChars(jLibName, pJLibName);
#ifdef DISABLE_DYNLOADING
(void) jSMgr;
(void) jRegKey;
(void) loader;
- fprintf(stderr, "Hmm, %s called for %s\n", __PRETTY_FUNCTION__, OUStringToOString(pJLibName, RTL_TEXTENCODING_JAVA_UTF8).getStr());
+ fprintf(stderr, "Hmm, %s called for %s\n", __PRETTY_FUNCTION__, OUStringToOString(aLibName, osl_getThreadTextEncoding()).getStr());
#else
osl::Module lib(aLibName, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL);
if (lib.is())
@@ -140,6 +140,8 @@ jobject Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory(
jobject jSMgr, jobject jRegKey, jobject loader )
{
const jchar* pJLibName = pJEnv->GetStringChars(jLibName, NULL);
+ OUString aLibName(pJLibName);
+ pJEnv->ReleaseStringChars(jLibName, pJLibName);
#ifdef DISABLE_DYNLOADING
(void) jImplName;
@@ -147,12 +149,9 @@ jobject Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory(
(void) jRegKey;
(void) loader;
- fprintf(stderr, "Hmm, %s called for %s\n", __PRETTY_FUNCTION__, OUStringToOString(pJLibName, RTL_TEXTENCODING_JAVA_UTF8).getStr());
+ fprintf(stderr, "Hmm, %s called for %s\n", __PRETTY_FUNCTION__, OUStringToOString(aLibName, osl_getThreadTextEncoding()).getStr());
#endif
- OUString aLibName( pJLibName );
- pJEnv->ReleaseStringChars( jLibName, pJLibName);
-
aLibName += OUString( SAL_DLLEXTENSION );
jobject joSLL_cpp = 0;
More information about the Libreoffice-commits
mailing list