diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-18 10:33:34 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-18 11:26:07 +0000 |
commit | 88c2e8bf6e13b943f0ada9a00a6863beb8f12e9b (patch) | |
tree | 8b1442daabe42064387ccdd37cea97de7835ffbf /sal | |
parent | 29b9df16dfbf17bbe9c46cd268849e6bfa97c84d (diff) |
coverity#1352316 Explicit null dereferenced
Change-Id: Ieb80209e0254080bf78fb3b5201b849d7d30880c
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/tempfile.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx index d6e7941a8fb5..69607b3c6bea 100644 --- a/sal/osl/unx/tempfile.cxx +++ b/sal/osl/unx/tempfile.cxx @@ -270,7 +270,6 @@ oslFileError SAL_CALL osl_createTempFile( rtl_uString** ppustrTempFileURL) { rtl_uString* base_directory = nullptr; - rtl_uString* temp_file_name = nullptr; oslFileHandle temp_file_handle; sal_Bool b_delete_on_close; oslFileError osl_error; @@ -285,16 +284,19 @@ oslFileError SAL_CALL osl_createTempFile( if (osl_File_E_None != osl_error) return osl_error; + rtl_uString* temp_file_name = nullptr; osl_error = osl_create_temp_file_impl_( base_directory, &temp_file_handle, &temp_file_name); + rtl_uString* temp_file_url = nullptr; if (osl_File_E_None == osl_error) { - rtl_uString* temp_file_url = nullptr; - - /* assuming this works */ - osl_getFileURLFromSystemPath(temp_file_name, &temp_file_url); + osl_error = osl_getFileURLFromSystemPath(temp_file_name, &temp_file_url); + rtl_uString_release(temp_file_name); + } + if (osl_File_E_None == osl_error) + { if (b_delete_on_close) { osl_error = osl_removeFile(temp_file_url); @@ -315,8 +317,6 @@ oslFileError SAL_CALL osl_createTempFile( } rtl_uString_release(temp_file_url); - - rtl_uString_release(temp_file_name); } rtl_uString_release(base_directory); |