summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-22 18:51:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-22 18:51:57 +0200
commit407db844120ead0d57118c40ab5e6acc1bad736d (patch)
tree455c5de18ea4c18b2e85f50da2a498e37d24814b /l10ntools
parent9adad0d1eae6e3d54042ab1e65f0b80a77562dc6 (diff)
Fix memory leak in xrmex tool
Change-Id: I102566a95b5b34daf60730ffef290913caf28eb2
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/inc/xrmlex.hxx2
-rw-r--r--l10ntools/source/xrmlex.l5
-rw-r--r--l10ntools/source/xrmmerge.cxx8
3 files changed, 5 insertions, 10 deletions
diff --git a/l10ntools/inc/xrmlex.hxx b/l10ntools/inc/xrmlex.hxx
index 2b159283d222..e1092433f2b6 100644
--- a/l10ntools/inc/xrmlex.hxx
+++ b/l10ntools/inc/xrmlex.hxx
@@ -30,7 +30,7 @@ extern "C" int InitXrmExport( const char * );
extern "C" int EndXrmExport();
extern "C" int GetError();
extern "C" int SetError();
-extern "C" char *GetOutputFile( int argc, char* argv[]);
+extern "C" bool GetOutputFile( int argc, char* argv[]);
extern "C" FILE *GetXrmFile();
extern "C" int isQuiet();
extern "C" const char* getFilename();
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index f91405f60655..c29406e030f4 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -205,12 +205,9 @@ void yyerror ( const char *s )
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
/* error level */
int nRetValue = 0;
- char *pOutput;
FILE *pFile;
- pOutput = GetOutputFile( argc, argv );
-
- if ( !pOutput )
+ if ( !GetOutputFile( argc, argv ) )
{
return 1;
}
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index 37190fb58623..510fc1a099fa 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -54,7 +54,7 @@ XRMResParser *pParser = NULL;
extern "C" {
// the whole interface to lexer is in this extern "C" section
-extern char *GetOutputFile( int argc, char* argv[])
+extern bool GetOutputFile( int argc, char* argv[])
{
bDisplayName = false;
bExtensionDescription = false;
@@ -67,15 +67,13 @@ extern char *GetOutputFile( int argc, char* argv[])
sInputFileName = aArgs.m_sInputFile;
sOutputFile = aArgs.m_sOutputFile;
sMergeSrc = aArgs.m_sMergeSrc;
- char *pReturn = new char[ sOutputFile.getLength() + 1 ];
- std::strcpy( pReturn, sOutputFile.getStr());
- return pReturn;
+ return true;
}
else
{
// command line is not valid
common::writeUsage("xrmex","*.xrm/*.xml");
- return NULL;
+ return false;
}
}