tools/source/xml/XmlWalker.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
New commits: commit 8148a46c7878158c4b701e2a5c374129e6ffdffc Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Sep 30 10:39:16 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Sep 30 13:58:19 2021 +0200 no need to copy the name in XmlWalker::attribute sName and the parameter we pass to xmlGetProp are both null-terminated char strings Change-Id: Ia8cb036f33cada8fa59d1e4f05df318a9cf28115 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122875 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/tools/source/xml/XmlWalker.cxx b/tools/source/xml/XmlWalker.cxx index 34a3d8746f6b..73199b4b665d 100644 --- a/tools/source/xml/XmlWalker.cxx +++ b/tools/source/xml/XmlWalker.cxx @@ -98,12 +98,11 @@ void XmlWalker::parent() OString XmlWalker::attribute(const OString& sName) { - xmlChar* xmlName = xmlCharStrdup(sName.getStr()); - xmlChar* xmlAttribute = xmlGetProp(mpImpl->mpCurrent, xmlName); + xmlChar* xmlAttribute + = xmlGetProp(mpImpl->mpCurrent, reinterpret_cast<const xmlChar*>(sName.getStr())); OString aAttributeContent( xmlAttribute == nullptr ? "" : reinterpret_cast<const char*>(xmlAttribute)); xmlFree(xmlAttribute); - xmlFree(xmlName); return aAttributeContent; }