mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-12-25 23:21:26 +03:00
xinclude: Don't use xmlHasNsProp
This function can malloc and doesn't report failures. Another design mistake is that xmlUnsetNsProp requires an xmlNs struct.
This commit is contained in:
parent
fe3cbf897e
commit
365976dbe0
11
xinclude.c
11
xinclude.c
@ -612,7 +612,7 @@ xmlXIncludeBaseFixup(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur, xmlNodePtr copy,
|
||||
const xmlChar *targetBase) {
|
||||
xmlChar *base = NULL;
|
||||
xmlChar *relBase = NULL;
|
||||
xmlAttrPtr attr;
|
||||
xmlNs ns;
|
||||
int res;
|
||||
|
||||
if (xmlNodeGetBaseSafe(cur->doc, cur, &base) < 0)
|
||||
@ -645,12 +645,9 @@ xmlXIncludeBaseFixup(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur, xmlNodePtr copy,
|
||||
/*
|
||||
* Delete existing xml:base if bases are equal
|
||||
*/
|
||||
attr = xmlHasNsProp(copy, BAD_CAST "base",
|
||||
XML_XML_NAMESPACE);
|
||||
if (attr != NULL) {
|
||||
xmlUnlinkNode((xmlNodePtr) attr);
|
||||
xmlFreeProp(attr);
|
||||
}
|
||||
memset(&ns, 0, sizeof(ns));
|
||||
ns.href = XML_XML_NAMESPACE;
|
||||
xmlUnsetNsProp(copy, &ns, BAD_CAST "base");
|
||||
|
||||
done:
|
||||
xmlFree(base);
|
||||
|
Loading…
Reference in New Issue
Block a user