mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
parse-xml.c: fixed a small memory leak related to xmlGetProp()
test_xslt_transforms(): xmlGetProp uses strdup(), so we have to clear the memory if a pointer is returned. xmlFree() doesn't seem very portable (strangly enought), so we use free(..) directly. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ef4a39c613
commit
dcad3af8b6
1 changed files with 7 additions and 2 deletions
|
@ -1549,8 +1549,13 @@ xmlDoc *test_xslt_transforms(xmlDoc *doc)
|
||||||
|
|
||||||
if (info->root) {
|
if (info->root) {
|
||||||
attribute = xmlGetProp(xmlFirstElementChild(root_element), "name");
|
attribute = xmlGetProp(xmlFirstElementChild(root_element), "name");
|
||||||
if (attribute && (strcasecmp(attribute, "subsurface") == 0))
|
if (attribute) {
|
||||||
return doc;
|
if (strcasecmp(attribute, "subsurface") == 0) {
|
||||||
|
free((void *)attribute);
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
free((void *)attribute);
|
||||||
|
}
|
||||||
|
|
||||||
xmlSubstituteEntitiesDefault(1);
|
xmlSubstituteEntitiesDefault(1);
|
||||||
xslt = get_stylesheet(info->file);
|
xslt = get_stylesheet(info->file);
|
||||||
|
|
Loading…
Add table
Reference in a new issue