Kaydet (Commit) d695fdf9 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in idlc::compileFile

Change-Id: I9f634466a084f8565aab4843f53702500014a133
Reviewed-on: https://gerrit.libreoffice.org/59772
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst cb2c7428
...@@ -314,8 +314,7 @@ sal_Int32 compileFile(const OString * pathname) ...@@ -314,8 +314,7 @@ sal_Int32 compileFile(const OString * pathname)
oslProcessError procError = osl_Process_E_None; oslProcessError procError = osl_Process_E_None;
const int nCmdArgs = lCppArgs.size(); const int nCmdArgs = lCppArgs.size();
rtl_uString** pCmdArgs = nullptr; std::unique_ptr<rtl_uString*[]> pCmdArgs(new rtl_uString*[nCmdArgs]);
pCmdArgs = static_cast<rtl_uString**>(rtl_allocateZeroMemory(nCmdArgs * sizeof(rtl_uString*)));
int i = 0; int i = 0;
for (auto const& elem : lCppArgs) for (auto const& elem : lCppArgs)
...@@ -323,7 +322,7 @@ sal_Int32 compileFile(const OString * pathname) ...@@ -323,7 +322,7 @@ sal_Int32 compileFile(const OString * pathname)
pCmdArgs[i++] = elem.pData; 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 ); nullptr, startDir.pData, nullptr, 0, &hProcess );
oslProcessInfo hInfo; oslProcessInfo hInfo;
...@@ -344,11 +343,9 @@ sal_Int32 compileFile(const OString * pathname) ...@@ -344,11 +343,9 @@ sal_Int32 compileFile(const OString * pathname)
pathname == nullptr ? "" : "file ", fileName.getStr()); pathname == nullptr ? "" : "file ", fileName.getStr());
osl_freeProcessHandle(hProcess); osl_freeProcessHandle(hProcess);
std::free(pCmdArgs);
exit(hInfo.Code ? hInfo.Code : 99); exit(hInfo.Code ? hInfo.Code : 99);
} }
osl_freeProcessHandle(hProcess); osl_freeProcessHandle(hProcess);
std::free(pCmdArgs);
if (unlink(tmpFile.getStr()) != 0) if (unlink(tmpFile.getStr()) != 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment