[Libreoffice-commits] core.git: sal/osl

Mark Wielaard mark at klomp.org
Wed Jul 31 09:20:48 PDT 2013


 sal/osl/unx/file_url.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 431d894f3e04a2fa0addc495587d0080b65c0e36
Author: Mark Wielaard <mark at klomp.org>
Date:   Tue Jul 30 23:46:10 2013 +0200

    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 <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 304f8b4..6026660 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;
 }
 


More information about the Libreoffice-commits mailing list