diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-02-21 03:07:22 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-20 17:21:25 -0800 |
commit | dcad3af8b63558d9d62cf995de6b4043c3f751fb (patch) | |
tree | 899f69428610633e728b4da47c6f19b6bf35a90b /parse-xml.c | |
parent | ef4a39c61332a9b627be544b7f80595f412d3016 (diff) | |
download | subsurface-dcad3af8b63558d9d62cf995de6b4043c3f751fb.tar.gz |
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>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/parse-xml.c b/parse-xml.c index 2f35a4fbe..b44d992cd 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -1549,8 +1549,13 @@ xmlDoc *test_xslt_transforms(xmlDoc *doc) if (info->root) { attribute = xmlGetProp(xmlFirstElementChild(root_element), "name"); - if (attribute && (strcasecmp(attribute, "subsurface") == 0)) - return doc; + if (attribute) { + if (strcasecmp(attribute, "subsurface") == 0) { + free((void *)attribute); + return doc; + } + free((void *)attribute); + } xmlSubstituteEntitiesDefault(1); xslt = get_stylesheet(info->file); |