summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2022-11-05 18:44:05 +0000
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-11-07 09:11:04 +0100
commit0d9613b77fc653c6144b5e4f0136c0536300c0db (patch)
treee6a4ecc750ea5a8f5864448d9bd0d06f377ed1c4 /sal
parentfa40ea19dbea5f0618d86da8626c35e734bb5220 (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/tempfile.cxx6
1 files changed, 6 insertions, 0 deletions
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);