diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-05-27 16:25:02 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-05-27 19:51:24 +0200 |
commit | a59a532371e3c4eb20e293dcdb4df812ee5506d0 (patch) | |
tree | b4a0416783105b89b63cbdc3e8a65fc9fd3f9766 /extensions | |
parent | ca8e04f1ab739e14288ab5e0be44723536b9ca4e (diff) |
Avoid calling osl_closeFile, osl_freeProcessHandle on null arguments
See the discussion in the comment at <https://gerrit.libreoffice.org/c/core/+/
94658/7#message-4afcb072d281450932788a9e8ea88cf2c6798e29> "Fix leak in
extensions/updatecheck".
Change-Id: I2314d108addbb4ef90762e5d5676c1d2480e1264
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94978
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/update/check/updatecheck.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 217c05986129..1f8faabadfd7 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -137,14 +137,14 @@ OUString getImageFromFileName(const OUString& aFile) nullptr, &hOut, nullptr // [out] File handles for redirected I/O ); - // Create a guard to ensure correct cleanup in its dtor in any case - comphelper::ScopeGuard g([hOut, hProcess] () { - osl_closeFile(hOut); - osl_freeProcessHandle(hProcess); - }); - if( osl_Process_E_None == rc ) { + // Create a guard to ensure correct cleanup in its dtor in any case + comphelper::ScopeGuard g([hOut, hProcess] () { + osl_closeFile(hOut); + osl_freeProcessHandle(hProcess); + }); + oslProcessInfo aInfo; aInfo.Size = sizeof(oslProcessInfo); |