summaryrefslogtreecommitdiff
path: root/sal/osl/unx/tempfile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/unx/tempfile.cxx')
-rw-r--r--sal/osl/unx/tempfile.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx
index 2f9fb7182db6..1070dbe0eaa1 100644
--- a/sal/osl/unx/tempfile.cxx
+++ b/sal/osl/unx/tempfile.cxx
@@ -305,16 +305,18 @@ oslFileError SAL_CALL osl_createTempFile(
osl_error = osl_removeFile(temp_file_url);
if (osl_error == osl_File_E_None)
+ {
*pHandle = temp_file_handle;
- else
- osl_closeFile(temp_file_handle);
+ temp_file_handle = nullptr;
+ }
}
else
{
if (pHandle)
+ {
*pHandle = temp_file_handle;
- else
- osl_closeFile(temp_file_handle);
+ temp_file_handle = nullptr;
+ }
rtl_uString_assign(ppustrTempFileURL, temp_file_url);
}
@@ -322,6 +324,9 @@ oslFileError SAL_CALL osl_createTempFile(
rtl_uString_release(temp_file_url);
}
+ if (temp_file_handle)
+ osl_closeFile(temp_file_handle);
+
rtl_uString_release(base_directory);
return osl_error;