summaryrefslogtreecommitdiff
path: root/javaunohelper
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-07 10:16:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-07 10:18:21 +0000
commit8eda0f7b07f8fb09b11c577882b5cd4a548e1423 (patch)
tree7cb62765098dba93ff6e8a2eecee240abef1056b /javaunohelper
parentfbe26ca557fc9dfd1ed904d08251b6cd34e6ce5d (diff)
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
Diffstat (limited to 'javaunohelper')
-rw-r--r--javaunohelper/source/javaunohelper.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/javaunohelper/source/javaunohelper.cxx b/javaunohelper/source/javaunohelper.cxx
index 05ad4c0c9591..99a9252c5194 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;