ucb/source/ucp/gio/gio_content.cxx |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit bc2fca254f8a9d7ca5eb156b7e3c19756a257e3b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Oct 19 09:28:00 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 19 14:49:05 2021 +0200

    Related: tdf#145169 use of freed pointer in gio create folder
    
    Change-Id: Ia5afdfb545791e143b8d34193de95e30b8f054b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123799
    Tested-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/ucb/source/ucp/gio/gio_content.cxx 
b/ucb/source/ucp/gio/gio_content.cxx
index 1e084d638126..debdcf8c4217 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -684,7 +684,7 @@ css::uno::Sequence< css::uno::Any > 
Content::setPropertyValues(
     aEvent.PropertyHandle = -1;
 
     sal_Int32 nChanged = 0, nTitlePos = -1;
-    const char *newName = nullptr;
+    OUString aNewTitle;
     css::uno::Sequence< css::beans::PropertyChangeEvent > aChanges(nCount);
 
     css::uno::Sequence< css::uno::Any > aRet( nCount );
@@ -704,7 +704,6 @@ css::uno::Sequence< css::uno::Any > 
Content::setPropertyValues(
         }
         else if ( rValue.Name == "Title" )
         {
-            OUString aNewTitle;
             if (!( rValue.Value >>= aNewTitle ))
             {
                 aRet[ n ] <<= css::beans::IllegalTypeException
@@ -723,7 +722,7 @@ css::uno::Sequence< css::uno::Any > 
Content::setPropertyValues(
             }
 
             OString sNewTitle = OUStringToOString(aNewTitle, 
RTL_TEXTENCODING_UTF8);
-            newName = sNewTitle.getStr();
+            const char *newName = sNewTitle.getStr();
             const char *oldName = g_file_info_get_name( pInfo);
 
             if (!newName || !oldName || strcmp(newName, oldName))
@@ -744,7 +743,6 @@ css::uno::Sequence< css::uno::Any > 
Content::setPropertyValues(
         {
             SAL_WARN("ucb.ucp.gio", "Unknown property " << rValue.Name);
             aRet[ n ] <<= getReadOnlyException( static_cast< cppu::OWeakObject 
* >(this) );
-            //TODO
         }
     }
 
@@ -764,8 +762,7 @@ css::uno::Sequence< css::uno::Any > 
Content::setPropertyValues(
         {
             if (nTitlePos > -1)
             {
-                OUString aNewURL = getParentURL() +
-                    OUString( newName, strlen(newName), RTL_TEXTENCODING_UTF8 
);
+                OUString aNewURL = getParentURL() + aNewTitle;
                 css::uno::Reference< css::ucb::XContentIdentifier > xNewId
                     = new ::ucbhelper::ContentIdentifier( aNewURL );
 

Reply via email to