mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-20 03:52:25 +03:00
Fixed memory leak reported by Dave Beckett Removed spurious comment
* parser.c, xmlmemory.c, include/libxml/xmlmemory.h: Fixed memory leak reported by Dave Beckett * xmlschemas.c: Removed spurious comment reported on the mailing list * xinclude.c, xpath.c, xpointer.c, libxml/include/xpointer.h: Further work on Bug 129967 concerning xpointer range handling and range-to function; much better, but still not complete
This commit is contained in:
48
xpath.c
48
xpath.c
@@ -10307,11 +10307,12 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
ctxt->context->doc = bakd;
|
||||
ctxt->context->node = bak;
|
||||
CHECK_ERROR0;
|
||||
if (op->ch2 != -1)
|
||||
if (op->ch2 != -1) {
|
||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||
ctxt->context->doc = bakd;
|
||||
ctxt->context->node = bak;
|
||||
CHECK_ERROR0;
|
||||
ctxt->context->doc = bakd;
|
||||
ctxt->context->node = bak;
|
||||
CHECK_ERROR0;
|
||||
}
|
||||
return (total);
|
||||
case XPATH_OP_PREDICATE:
|
||||
case XPATH_OP_FILTER:{
|
||||
@@ -10594,7 +10595,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
xmlLocationSetPtr newlocset = NULL;
|
||||
xmlLocationSetPtr oldlocset;
|
||||
xmlNodeSetPtr oldset;
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
if (op->ch1 != -1)
|
||||
total +=
|
||||
@@ -10611,9 +10612,9 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
CHECK_TYPE0(XPATH_LOCATIONSET);
|
||||
obj = valuePop(ctxt);
|
||||
oldlocset = obj->user;
|
||||
ctxt->context->node = NULL;
|
||||
|
||||
if ((oldlocset == NULL) || (oldlocset->locNr == 0)) {
|
||||
ctxt->context->node = NULL;
|
||||
ctxt->context->contextSize = 0;
|
||||
ctxt->context->proximityPosition = 0;
|
||||
total += xmlXPathCompOpEval(ctxt,&comp->steps[op->ch2]);
|
||||
@@ -10631,11 +10632,11 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
* Run the evaluation with a node list made of a
|
||||
* single item in the nodelocset.
|
||||
*/
|
||||
ctxt->context->node = oldlocset->locTab[i]->user;
|
||||
ctxt->context->node = (xmlNodePtr)ctxt->context->doc;
|
||||
ctxt->context->contextSize = 1;
|
||||
ctxt->context->proximityPosition = 1;
|
||||
tmp = xmlXPathNewNodeSet(ctxt->context->node);
|
||||
valuePush(ctxt, tmp);
|
||||
ctxt->context->contextSize = oldlocset->locNr;
|
||||
ctxt->context->proximityPosition = i + 1;
|
||||
|
||||
if (op->ch2 != -1)
|
||||
total +=
|
||||
@@ -10644,14 +10645,29 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
CHECK_ERROR0;
|
||||
|
||||
/*
|
||||
* The result of the evaluation need to be tested to
|
||||
* decided whether the filter succeeded or not
|
||||
* The result of the evaluation needs to be tested to
|
||||
* decide whether the filter succeeded or not
|
||||
*/
|
||||
res = valuePop(ctxt);
|
||||
if (xmlXPathEvaluatePredicateResult(ctxt, res)) {
|
||||
xmlXPtrLocationSetAdd(newlocset,
|
||||
xmlXPathObjectCopy
|
||||
(oldlocset->locTab[i]));
|
||||
if (res->type == XPATH_LOCATIONSET) {
|
||||
xmlLocationSetPtr rloc =
|
||||
(xmlLocationSetPtr)res->user;
|
||||
for (j=0; j<rloc->locNr; j++) {
|
||||
range = xmlXPtrNewRange(
|
||||
oldlocset->locTab[i]->user,
|
||||
oldlocset->locTab[i]->index,
|
||||
rloc->locTab[j]->user2,
|
||||
rloc->locTab[j]->index2);
|
||||
if (range != NULL) {
|
||||
xmlXPtrLocationSetAdd(newlocset, range);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
range = xmlXPtrNewRangeNodeObject(
|
||||
(xmlNodePtr)oldlocset->locTab[i]->user, res);
|
||||
if (range != NULL) {
|
||||
xmlXPtrLocationSetAdd(newlocset,range);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -10666,7 +10682,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
|
||||
ctxt->context->node = NULL;
|
||||
}
|
||||
} else { /* Not a location set */
|
||||
} else { /* Not a location set */
|
||||
CHECK_TYPE0(XPATH_NODESET);
|
||||
obj = valuePop(ctxt);
|
||||
oldset = obj->nodesetval;
|
||||
|
Reference in New Issue
Block a user