diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-28 15:30:42 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-28 20:27:48 +0200 |
commit | 0578353a4d602805124fb642c7051d99f55e4599 (patch) | |
tree | 2b9d4b57489840915f7060ea113f9f4195395e88 /sal/osl/all | |
parent | 5cb3a6da2a61b9bc1acb5b47ac80cdcdc69294e2 (diff) |
tdf#120703 PVS: dereference before nullptr check
V595 The 'ustrFile' pointer was utilized before it was verified against nullptr.
Check lines: 83, 107.
Change-Id: I874983508fb805b1f0a55b3a5b6d4d78ae1babdb
Reviewed-on: https://gerrit.libreoffice.org/71472
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal/osl/all')
-rw-r--r-- | sal/osl/all/filepath.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sal/osl/all/filepath.cxx b/sal/osl/all/filepath.cxx index 7e8022f4f9e8..ae917c6d90ed 100644 --- a/sal/osl/all/filepath.cxx +++ b/sal/osl/all/filepath.cxx @@ -19,6 +19,7 @@ #include <osl/file.h> #include <rtl/ustring.h> +#include <cassert> static sal_uInt32 osl_defCalcTextWidth( rtl_uString *ustrText ) { @@ -49,6 +50,8 @@ oslFileError SAL_CALL osl_abbreviateSystemPath( rtl_uString *ustrSystemPath, rtl } } + assert(ustrPath && ustrFile); + uPathWidth = pfnCalcWidth( ustrPath ); uFileWidth = pfnCalcWidth( ustrFile ); @@ -101,11 +104,8 @@ oslFileError SAL_CALL osl_abbreviateSystemPath( rtl_uString *ustrSystemPath, rtl uPathWidth = pfnCalcWidth( *pustrCompacted ); } - if ( ustrPath ) - rtl_uString_release( ustrPath ); - - if ( ustrFile ) - rtl_uString_release( ustrFile ); + rtl_uString_release(ustrPath); + rtl_uString_release(ustrFile); return osl_File_E_None; } |