sal/osl/unx/tempfile.cxx | 6 ++++++ 1 file changed, 6 insertions(+) New commits: commit 0d9613b77fc653c6144b5e4f0136c0536300c0db Author: Dr. David Alan Gilbert <d...@treblig.org> AuthorDate: Sat Nov 5 18:44:05 2022 +0000 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Nov 7 09:11:04 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> 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);