ucb/source/ucp/webdav-curl/DAVProperties.cxx | 53 ++++++++++++--------------- ucb/source/ucp/webdav-curl/DAVProperties.hxx | 3 + 2 files changed, 27 insertions(+), 29 deletions(-)
New commits: commit 96939c730332d4f65d02bd633bb0c8bf1bbad5d4 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Jul 30 11:16:11 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Jul 31 10:01:01 2025 +0200 cid#1660121 Resource leak and cid#1660097 Resource leak Change-Id: Ife9963022f93f1288439928156a10a10dc25da9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188592 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/ucb/source/ucp/webdav-curl/DAVProperties.cxx b/ucb/source/ucp/webdav-curl/DAVProperties.cxx index bd0be1a862c4..85f5bb44fc66 100644 --- a/ucb/source/ucp/webdav-curl/DAVProperties.cxx +++ b/ucb/source/ucp/webdav-curl/DAVProperties.cxx @@ -31,31 +31,31 @@ void DAVProperties::createSerfPropName( ::std::u16string_view const rFullName, { if (o3tl::starts_with(rFullName, u"DAV:")) { - rName.nspace = "DAV:"; + rName.nspace = "DAV:"_ostr; rName.name - = strdup( OUStringToOString( - rFullName.substr(RTL_CONSTASCII_LENGTH("DAV:")), - RTL_TEXTENCODING_UTF8 ).getStr() ); + = OUStringToOString( + rFullName.substr(RTL_CONSTASCII_LENGTH("DAV:")), + RTL_TEXTENCODING_UTF8 ); } else if (o3tl::starts_with(rFullName, u"http://apache.org/dav/props/")) { - rName.nspace = "http://apache.org/dav/props/"; - rName.name - = strdup( OUStringToOString( - rFullName.substr( - RTL_CONSTASCII_LENGTH( - "http://apache.org/dav/props/" ) ), - RTL_TEXTENCODING_UTF8 ).getStr() ); + rName.nspace = "http://apache.org/dav/props/"_ostr; + rName.name = + OUStringToOString( + rFullName.substr( + RTL_CONSTASCII_LENGTH( + "http://apache.org/dav/props/" ) ), + RTL_TEXTENCODING_UTF8 ); } else if (o3tl::starts_with(rFullName, u"http://ucb.openoffice.org/dav/props/")) { - rName.nspace = "http://ucb.openoffice.org/dav/props/"; - rName.name - = strdup( OUStringToOString( - rFullName.substr( - RTL_CONSTASCII_LENGTH( - "http://ucb.openoffice.org/dav/props/" ) ), - RTL_TEXTENCODING_UTF8 ).getStr() ); + rName.nspace = "http://ucb.openoffice.org/dav/props/"_ostr; + rName.name = + OUStringToOString( + rFullName.substr( + RTL_CONSTASCII_LENGTH( + "http://ucb.openoffice.org/dav/props/" ) ), + RTL_TEXTENCODING_UTF8 ); } else if (o3tl::starts_with(rFullName, u"<prop:")) { @@ -68,11 +68,11 @@ void DAVProperties::createSerfPropName( ::std::u16string_view const rFullName, sal_Int32 nStart = RTL_CONSTASCII_LENGTH( "<prop:" ); sal_Int32 nLen = aFullName.indexOf( ' ' ) - nStart; - rName.name = strdup( aFullName.copy( nStart, nLen ).getStr() ); + rName.name = aFullName.copy( nStart, nLen ); nStart = aFullName.indexOf( '=', nStart + nLen ) + 2; // after =" nLen = aFullName.getLength() - RTL_CONSTASCII_LENGTH( "\">" ) - nStart; - rName.nspace = strdup( aFullName.copy( nStart, nLen ).getStr() ); + rName.nspace = aFullName.copy( nStart, nLen ); } else { @@ -80,10 +80,10 @@ void DAVProperties::createSerfPropName( ::std::u16string_view const rFullName, // to the "<prop:" form above assert(rFullName.find(':') == ::std::u16string_view::npos); // Add our namespace to our own properties. - rName.nspace = "http://ucb.openoffice.org/dav/props/"; - rName.name - = strdup( OUStringToOString( rFullName, - RTL_TEXTENCODING_UTF8 ).getStr() ); + rName.nspace = "http://ucb.openoffice.org/dav/props/"_ostr; + rName.name = + OUStringToOString( rFullName, + RTL_TEXTENCODING_UTF8 ); } } @@ -154,10 +154,7 @@ void DAVProperties::createUCBPropName( const char * nspace, // static bool DAVProperties::isUCBDeadProperty( const SerfPropName & rName ) { - return ( rName.nspace && - ( rtl_str_compareIgnoreAsciiCase( - rName.nspace, "http://ucb.openoffice.org/dav/props/" ) - == 0 ) ); + return rName.nspace.equalsIgnoreAsciiCase("http://ucb.openoffice.org/dav/props/"); } bool DAVProperties::isUCBSpecialProperty(std::u16string_view rFullName, OUString& rParsedName) diff --git a/ucb/source/ucp/webdav-curl/DAVProperties.hxx b/ucb/source/ucp/webdav-curl/DAVProperties.hxx index 8466692612a0..392177b0870c 100644 --- a/ucb/source/ucp/webdav-curl/DAVProperties.hxx +++ b/ucb/source/ucp/webdav-curl/DAVProperties.hxx @@ -21,11 +21,12 @@ #pragma once #include <rtl/ustring.hxx> +#include <rtl/string.hxx> namespace http_dav_ucp { -typedef struct { const char *nspace, *name; } SerfPropName; +typedef struct { OString nspace; OString name; } SerfPropName; struct DAVProperties {