[Libreoffice-commits] core.git: l10ntools/inc l10ntools/source

Stephan Bergmann sbergman at redhat.com
Thu May 22 09:52:34 PDT 2014


 l10ntools/inc/xrmlex.hxx      |    2 +-
 l10ntools/source/xrmlex.l     |    5 +----
 l10ntools/source/xrmmerge.cxx |    8 +++-----
 3 files changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 407db844120ead0d57118c40ab5e6acc1bad736d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu May 22 18:51:57 2014 +0200

    Fix memory leak in xrmex tool
    
    Change-Id: I102566a95b5b34daf60730ffef290913caf28eb2

diff --git a/l10ntools/inc/xrmlex.hxx b/l10ntools/inc/xrmlex.hxx
index 2b15928..e109243 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 f91405f..c29406e 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 37190fb..510fc1a 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;
     }
 }
 


More information about the Libreoffice-commits mailing list