[xml] possible bug and patch
- From: Jason Adams <jadams nyscul org>
- To: xml gnome org
- Subject: [xml] possible bug and patch
- Date: Thu, 22 Aug 2002 14:18:55 -0400
hi
I was looking at the source for "xmlXPathRegisterNs" and it's related
functions to get an idea of how they worked when I noticed something odd
in the memory management. "xmlXPathRegisterNs" passes "xmlFree" on to
"xmlHashUpdateEntry" but it doesn't allocate anything. Also
"xmlXPathRegisteredNsCleanup" doesn pass a deallocation routine to
"xmlHashFree".
I believe the attached patch should fix it. I haven't really tested it
apart from seeing if "make check" died.
Jason Adams
--- xpath.c.orig Thu Aug 22 13:34:25 2002
+++ xpath.c Thu Aug 22 13:49:12 2002
@@ -2826,5 +2826,5 @@
if (ctxt->nsHash == NULL)
return(-1);
- return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) ns_uri,
+ return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri),
(xmlHashDeallocator)xmlFree));
}
@@ -2876,5 +2876,5 @@
return;
- xmlHashFree(ctxt->nsHash, NULL);
+ xmlHashFree(ctxt->nsHash, (xmlHashDeallocator)xmlFree);
ctxt->nsHash = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]