[PATCH] coverity#983032: Resource leak
Julien Nabet (via Code Review)
gerrit at gerrit.libreoffice.org
Tue May 7 15:55:16 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3820
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/20/3820/1
coverity#983032: Resource leak
Change-Id: I0f2b245c98d80a009076494a232229c19cc034a9
---
M l10ntools/source/xrmlex.l
M l10ntools/source/xrmmerge.cxx
2 files changed, 9 insertions(+), 39 deletions(-)
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index a2b5c0c..1ada7fe 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -57,11 +57,10 @@
/* external functions (C++ code, declared as extern "C" */
extern "C" int WorkOnTokenSet( int, char* );
extern "C" int Argument( char * );
-extern "C" int InitXrmExport( char * , char * );
+extern "C" int InitXrmExport( char * );
extern "C" int EndXrmExport();
extern "C" int GetError();
extern "C" int SetError();
-extern "C" char *GetOutputFile( int argc, char* argv[]);
extern "C" FILE *GetXrmFile();
extern "C" int isQuiet();
extern "C" char* getFilename();
@@ -214,28 +213,24 @@
SetError();
}
+//SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
+ // these are not used, so just quiet warnings
+ (void) argc;
+ (void) argv;
/* error level */
int nRetValue = 0;
- char *pOutput;
FILE *pFile;
- pOutput = GetOutputFile( argc, argv );
-
- if ( !pOutput )
- {
- return 1;
- }
pFile = GetXrmFile();
- InitXrmExport( pOutput , getFilename() );
+ /* create global instance of class XmlExport */
+ InitXrmExport( getFilename() );
- if ( !pFile )
+ if ( !pFile )
return 1;
yyin = pFile;
- /* create global instance of class XmlExport */
- //InitXrmExport( pOutput );
/* start parser */
yylex();
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index 8a8b856..e806bcf 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -53,32 +53,7 @@
extern "C" {
// the whole interface to lexer is in this extern "C" section
-extern char *GetOutputFile( int argc, char* argv[])
-{
- bDisplayName = sal_False;
- bExtensionDescription = sal_False;
-
- common::HandledArgs aArgs;
- if ( common::handleArguments(argc, argv, aArgs) )
- {
- bMergeMode = aArgs.m_bMergeMode;
- sLanguage = aArgs.m_sLanguage;
- 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;
- }
- else
- {
- // command line is not valid
- common::writeUsage("xrmex","*.xrm/*.xml");
- return NULL;
- }
-}
-
-int InitXrmExport( char*, char* pFilename)
+int InitXrmExport( char* pFilename)
{
// instanciate Export
OString sFilename( pFilename );
--
To view, visit https://gerrit.libreoffice.org/3820
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f2b245c98d80a009076494a232229c19cc034a9
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Julien Nabet <serval2412 at yahoo.fr>
More information about the LibreOffice
mailing list