From 84d9d0abe7bde979aed6222ba364deecba533d53 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Fri, 19 May 2023 13:40:40 +1200 Subject: [PATCH] Desktop: Fix incorrect use of 'free()'. Use 'xmlFree()' to free memory returned by libxml. Follow-up to #3900. Signed-off-by: Michael Keller --- core/parse-xml.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/parse-xml.c b/core/parse-xml.c index 9affb3f81..75dafaedd 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -2341,16 +2341,16 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const struct xml_params *params xmlDoc *transformed; xsltStylesheetPtr xslt = NULL; xmlNode *root_element = xmlDocGetRootElement(doc); - char *attribute; + xmlChar *attribute; while (info->root) { if ((strcasecmp((const char *)root_element->name, info->root) == 0)) { if (info->attribute == NULL) break; - void *prop = xmlGetProp(root_element, (const xmlChar *)info->attribute); + xmlChar *prop = xmlGetProp(root_element, (const xmlChar *)info->attribute); if (prop != NULL) { - free(prop); + xmlFree(prop); break; } @@ -2359,13 +2359,13 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const struct xml_params *params } if (info->root) { - attribute = (char *)xmlGetProp(xmlFirstElementChild(root_element), (const xmlChar *)"name"); + attribute = xmlGetProp(xmlFirstElementChild(root_element), (const xmlChar *)"name"); if (attribute) { - if (strcasecmp(attribute, "subsurface") == 0) { - free((void *)attribute); + if (strcasecmp((char *)attribute, "subsurface") == 0) { + xmlFree(attribute); return doc; } - free((void *)attribute); + xmlFree(attribute); } xmlSubstituteEntitiesDefault(1); xslt = get_stylesheet(info->file);