From 431d894f3e04a2fa0addc495587d0080b65c0e36 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 30 Jul 2013 23:46:10 +0200 Subject: Fix memory leak in osl_getSystemPathFromFileURL. rtl_uStrings should never be directly assigned. That might mess up reference counting. osl_getSystemPathFromFileURL can be called with pustrSystemPath pointing to a non-empty rtl_uStrings. A special case being when the ustrFileURL input and the pustrSystemPath output point to the same rtl_uString instance. So use rtl_uString_assign. Change-Id: I48e17817cba905a4a6d4bc303d072d62941b0d9c Reviewed-on: https://gerrit.libreoffice.org/5209 Reviewed-by: Fridrich Strba Tested-by: Fridrich Strba --- sal/osl/unx/file_url.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx index 304f8b4a5b93..6026660635db 100644 --- a/sal/osl/unx/file_url.cxx +++ b/sal/osl/unx/file_url.cxx @@ -283,7 +283,8 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt OSL_ASSERT( !findWrongUsage( pTmp->buffer, pTmp->length ) ); */ - *pustrSystemPath = pTmp; + rtl_uString_assign ( pustrSystemPath, pTmp ); + rtl_uString_release ( pTmp ); return osl_File_E_None; } -- cgit