extensions/source/update/check/updatecheck.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a59a532371e3c4eb20e293dcdb4df812ee5506d0
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed May 27 16:25:02 2020 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed May 27 19:51:24 2020 +0200

    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 <sberg...@redhat.com>

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);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to