diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-02 15:54:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-02 22:15:43 +0200 |
commit | 668e68d3dfe7f187c51c5ff9af752a8d0369b426 (patch) | |
tree | 4382dd776bcb0c8925bdd4d3983d62b30513f75a /sal | |
parent | 46d5bde3800e3010978ed650cfe72908698944de (diff) |
coverity#1438194 silence Resource leak
Change-Id: I54cf8e4fc430feb2e34d3f6f0f2abce81973b09a
Reviewed-on: https://gerrit.libreoffice.org/58481
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/tempfile.cxx | 13 |
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; |