sal/osl/unx/tempfile.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit df994d621261141ae024ead711f2ee957347476b
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Sat Nov 5 18:44:05 2022 +0000
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Wed Nov 16 18:23:17 2022 +0100

    TempFile: clear handle on close
    
    If we close the file on error, then clear the handle we returned to
    the caller so it doesn't try and close it again or do anything else
    with it.
    
    Change-Id: Idd054f92f4f3cbc3427896ec9795e588471292d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142344
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 0d9613b77fc653c6144b5e4f0136c0536300c0db)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142306
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 84d292960bee73f24450857ff141953be2570094)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142434
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx
index 29a4d453f80c..3a7138b5218d 100644
--- a/sal/osl/unx/tempfile.cxx
+++ b/sal/osl/unx/tempfile.cxx
@@ -330,7 +330,13 @@ oslFileError SAL_CALL osl_createTempFile(
     }
 
     if (temp_file_handle)
+    {
         osl_closeFile(temp_file_handle);
+        if (pHandle)
+        {
+            *pHandle = nullptr;
+        }
+    }
 
     rtl_uString_release(base_directory);
 

Reply via email to