mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Desktop: Fix incorrect use of 'free()'.
Use 'xmlFree()' to free memory returned by libxml. Follow-up to #3900. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
d7bfb9d61e
commit
84d9d0abe7
1 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue