diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 12:38:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-30 08:30:32 +0200 |
commit | d695fdf9ddf713c90b4c53fc1a7eb96a8ff5f065 (patch) | |
tree | 9c704ae3b201af6d1ac4e34ea1c30c8f1840528d /idlc/source/idlccompile.cxx | |
parent | cb2c7428f68d2c07f5e97ae4b42fee7c43e709a8 (diff) |
loplugin:useuniqueptr in idlc::compileFile
Change-Id: I9f634466a084f8565aab4843f53702500014a133
Reviewed-on: https://gerrit.libreoffice.org/59772
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idlc/source/idlccompile.cxx')
-rw-r--r-- | idlc/source/idlccompile.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
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) { |