mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Fixed a really nasty problem raised by a DocBook XSLT transform provided
* entities.c parser.c tree.c include/libxml/entities.h: Fixed a really nasty problem raised by a DocBook XSLT transform provided by Sebastian Bergmann Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Mon Dec 30 00:59:07 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* entities.c parser.c tree.c include/libxml/entities.h: Fixed
|
||||||
|
a really nasty problem raised by a DocBook XSLT transform
|
||||||
|
provided by Sebastian Bergmann
|
||||||
|
|
||||||
Sun Dec 29 12:13:18 CET 2002 Daniel Veillard <daniel@veillard.com>
|
Sun Dec 29 12:13:18 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xmlreader.c python/tests/reader.py: fixed a bug pointed out
|
* xmlreader.c python/tests/reader.py: fixed a bug pointed out
|
||||||
|
19
entities.c
19
entities.c
@ -48,7 +48,7 @@ static xmlHashTablePtr xmlPredefinedEntities = NULL;
|
|||||||
static void xmlFreeEntity(xmlEntityPtr entity) {
|
static void xmlFreeEntity(xmlEntityPtr entity) {
|
||||||
if (entity == NULL) return;
|
if (entity == NULL) return;
|
||||||
|
|
||||||
if ((entity->children) &&
|
if ((entity->children) && (entity->owner == 1) &&
|
||||||
(entity == (xmlEntityPtr) entity->children->parent))
|
(entity == (xmlEntityPtr) entity->children->parent))
|
||||||
xmlFreeNodeList(entity->children);
|
xmlFreeNodeList(entity->children);
|
||||||
if (entity->name != NULL)
|
if (entity->name != NULL)
|
||||||
@ -127,6 +127,7 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type,
|
|||||||
ret->URI = NULL; /* to be computed by the layer knowing
|
ret->URI = NULL; /* to be computed by the layer knowing
|
||||||
the defining entity */
|
the defining entity */
|
||||||
ret->orig = NULL;
|
ret->orig = NULL;
|
||||||
|
ret->owner = 0;
|
||||||
|
|
||||||
if (xmlHashAddEntry(table, name, ret)) {
|
if (xmlHashAddEntry(table, name, ret)) {
|
||||||
/*
|
/*
|
||||||
@ -846,6 +847,20 @@ xmlCreateEntitiesTable(void) {
|
|||||||
return((xmlEntitiesTablePtr) xmlHashCreate(0));
|
return((xmlEntitiesTablePtr) xmlHashCreate(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlFreeEntityWrapper:
|
||||||
|
* @entity: An entity
|
||||||
|
* @name: its name
|
||||||
|
*
|
||||||
|
* Deallocate the memory used by an entities in the hash table.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
xmlFreeEntityWrapper(xmlEntityPtr entity,
|
||||||
|
const xmlChar *name ATTRIBUTE_UNUSED) {
|
||||||
|
if (entity != NULL)
|
||||||
|
xmlFreeEntity(entity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlFreeEntitiesTable:
|
* xmlFreeEntitiesTable:
|
||||||
* @table: An entity table
|
* @table: An entity table
|
||||||
@ -854,7 +869,7 @@ xmlCreateEntitiesTable(void) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
|
xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
|
||||||
xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntity);
|
xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,6 +52,7 @@ struct _xmlEntity {
|
|||||||
|
|
||||||
struct _xmlEntity *nexte; /* unused */
|
struct _xmlEntity *nexte; /* unused */
|
||||||
const xmlChar *URI; /* the full URI as computed */
|
const xmlChar *URI; /* the full URI as computed */
|
||||||
|
int owner; /* does the entity own the childrens */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
4
parser.c
4
parser.c
@ -5474,6 +5474,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
|||||||
(ent->children == NULL)) {
|
(ent->children == NULL)) {
|
||||||
ent->children = list;
|
ent->children = list;
|
||||||
ent->last = list;
|
ent->last = list;
|
||||||
|
ent->owner = 1;
|
||||||
list->parent = (xmlNodePtr) ent;
|
list->parent = (xmlNodePtr) ent;
|
||||||
} else {
|
} else {
|
||||||
xmlFreeNodeList(list);
|
xmlFreeNodeList(list);
|
||||||
@ -5539,7 +5540,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
|||||||
(list->next == NULL)) {
|
(list->next == NULL)) {
|
||||||
list->parent = (xmlNodePtr) ent;
|
list->parent = (xmlNodePtr) ent;
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
ent->owner = 1;
|
||||||
} else {
|
} else {
|
||||||
|
ent->owner = 0;
|
||||||
while (list != NULL) {
|
while (list != NULL) {
|
||||||
list->parent = (xmlNodePtr) ctxt->node;
|
list->parent = (xmlNodePtr) ctxt->node;
|
||||||
list->doc = ctxt->myDoc;
|
list->doc = ctxt->myDoc;
|
||||||
@ -5552,6 +5555,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlAddEntityReference(ent, list, NULL);
|
xmlAddEntityReference(ent, list, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
ent->owner = 1;
|
||||||
while (list != NULL) {
|
while (list != NULL) {
|
||||||
list->parent = (xmlNodePtr) ent;
|
list->parent = (xmlNodePtr) ent;
|
||||||
if (list->next == NULL)
|
if (list->next == NULL)
|
||||||
|
1
tree.c
1
tree.c
@ -837,6 +837,7 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
|
|||||||
|
|
||||||
ent->children = xmlStringGetNodeList(doc,
|
ent->children = xmlStringGetNodeList(doc,
|
||||||
(const xmlChar*)node->content);
|
(const xmlChar*)node->content);
|
||||||
|
ent->owner = 1;
|
||||||
temp = ent->children;
|
temp = ent->children;
|
||||||
while (temp) {
|
while (temp) {
|
||||||
temp->parent = (xmlNodePtr)ent;
|
temp->parent = (xmlNodePtr)ent;
|
||||||
|
Reference in New Issue
Block a user