[Libreoffice-commits] core.git: idlc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Aug 30 06:31:01 UTC 2018
idlc/source/idlccompile.cxx | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
New commits:
commit d695fdf9ddf713c90b4c53fc1a7eb96a8ff5f065
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 29 12:38:22 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 30 08:30:32 2018 +0200
loplugin:useuniqueptr in idlc::compileFile
Change-Id: I9f634466a084f8565aab4843f53702500014a133
Reviewed-on: https://gerrit.libreoffice.org/59772
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 8d6386b66a44..3492e899e733 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -314,8 +314,7 @@ sal_Int32 compileFile(const OString * pathname)
oslProcessError procError = osl_Process_E_None;
const int nCmdArgs = lCppArgs.size();
- rtl_uString** pCmdArgs = nullptr;
- pCmdArgs = static_cast<rtl_uString**>(rtl_allocateZeroMemory(nCmdArgs * sizeof(rtl_uString*)));
+ std::unique_ptr<rtl_uString*[]> pCmdArgs(new rtl_uString*[nCmdArgs]);
int i = 0;
for (auto const& elem : lCppArgs)
@@ -323,7 +322,7 @@ sal_Int32 compileFile(const OString * pathname)
pCmdArgs[i++] = elem.pData;
}
- procError = osl_executeProcess( cpp.pData, pCmdArgs, nCmdArgs, osl_Process_WAIT,
+ procError = osl_executeProcess( cpp.pData, pCmdArgs.get(), nCmdArgs, osl_Process_WAIT,
nullptr, startDir.pData, nullptr, 0, &hProcess );
oslProcessInfo hInfo;
@@ -344,11 +343,9 @@ sal_Int32 compileFile(const OString * pathname)
pathname == nullptr ? "" : "file ", fileName.getStr());
osl_freeProcessHandle(hProcess);
- std::free(pCmdArgs);
exit(hInfo.Code ? hInfo.Code : 99);
}
osl_freeProcessHandle(hProcess);
- std::free(pCmdArgs);
if (unlink(tmpFile.getStr()) != 0)
{
More information about the Libreoffice-commits
mailing list