diff --git a/ChangeLog b/ChangeLog index 43975f73..49198c10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Oct 29 12:16:52 CET 2003 Daniel Veillard + + * xpath.c: change suggested by Anthony Carrico when unregistering + a namespace prefix to a context + * hash.c: be more careful about calling callbacks with NULL payloads. + Wed Oct 29 00:04:26 CET 2003 Daniel Veillard * configure.in NEWS doc/*: preparing release 2.6.1, updated and diff --git a/NEWS b/NEWS index 653a6f0c..aa70e733 100644 --- a/NEWS +++ b/NEWS @@ -23,7 +23,7 @@ to test those - More testing on RelaxNG Zlatkovic) - xmlWriter bugfix (Alfred Mickautsch) - chvalid.[ch]: couple of fixes from Stephane Bidoul - - context reset: error state reset, push parser reset (Graham Benett) + - context reset: error state reset, push parser reset (Graham Bennett) - context reuse: generate errors if file is not readable - defaulted attributes for element coming from internal entities (Stephane Bidoul) diff --git a/hash.c b/hash.c index 3fb8552d..ff06b01f 100644 --- a/hash.c +++ b/hash.c @@ -280,7 +280,7 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { inside_table = 1; while (iter) { next = iter->next; - if (f) + if ((f != NULL) && (iter->payload != NULL)) f(iter->payload, iter->name); if (iter->name) xmlFree(iter->name); @@ -718,7 +718,7 @@ xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { iter = &(table->table[i]); while (iter) { next = iter->next; - if (f) + if ((f != NULL) && (iter->payload != NULL)) f(iter->payload, data, iter->name, iter->name2, iter->name3); iter = next; @@ -783,7 +783,8 @@ xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, next = iter->next; if (((name == NULL) || (xmlStrEqual(name, iter->name))) && ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) && - ((name3 == NULL) || (xmlStrEqual(name3, iter->name3)))) { + ((name3 == NULL) || (xmlStrEqual(name3, iter->name3))) && + (iter->payload != NULL)) { f(iter->payload, data, iter->name, iter->name2, iter->name3); } @@ -916,7 +917,7 @@ xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, if (xmlStrEqual(entry->name, name) && xmlStrEqual(entry->name2, name2) && xmlStrEqual(entry->name3, name3)) { - if(f) + if ((f != NULL) && (entry->payload != NULL)) f(entry->payload, entry->name); entry->payload = NULL; if(entry->name) diff --git a/xpath.c b/xpath.c index 6e7e4716..627fa20b 100644 --- a/xpath.c +++ b/xpath.c @@ -2974,6 +2974,9 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix, ctxt->nsHash = xmlHashCreate(10); if (ctxt->nsHash == NULL) return(-1); + if (ns_uri == NULL) + return(xmlHashRemoveEntry(ctxt->nsHash, ns_uri, + (xmlHashDeallocator)xmlFree)); return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri), (xmlHashDeallocator)xmlFree)); }