Revert "xpath: Fix popping of values in xmlXPathPopNodeset"

This reverts commit 47b0e0a620d1e0e657b858986e3ebde80d4645b4.
This commit is contained in:
Nick Wellnhofer 2023-02-26 15:17:15 +01:00
parent bc9f372c10
commit 8608b71fbc

13
xpath.c
View File

@ -3042,15 +3042,16 @@ xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr obj;
xmlNodeSetPtr ret;
obj = valuePop(ctxt);
if (obj == NULL) {
if (ctxt == NULL) return(NULL);
if (ctxt->value == NULL) {
xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
return(NULL);
}
if (obj->type != XPATH_NODESET) {
if (!xmlXPathStackIsNodeSet(ctxt)) {
xmlXPathSetTypeError(ctxt);
return(NULL);
}
obj = valuePop(ctxt);
ret = obj->nodesetval;
#if 0
/* to fix memory leak of not clearing obj->user */
@ -3076,15 +3077,15 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr obj;
void * ret;
obj = valuePop(ctxt);
if (obj == NULL) {
if ((ctxt == NULL) || (ctxt->value == NULL)) {
xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
return(NULL);
}
if (obj->type != XPATH_USERS) {
if (ctxt->value->type != XPATH_USERS) {
xmlXPathSetTypeError(ctxt);
return(NULL);
}
obj = valuePop(ctxt);
ret = obj->user;
obj->user = NULL;
xmlXPathReleaseObject(ctxt->context, obj);