1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-31 06:50:06 +03:00

valid: Fix and check return value of nodeVPush

This commit is contained in:
Nick Wellnhofer 2024-12-18 12:02:36 +01:00
parent 3f0bac4820
commit 0d4a17af49

20
valid.c
View File

@ -368,12 +368,12 @@ nodeVPush(xmlValidCtxtPtr ctxt, xmlNodePtr value)
4, XML_MAX_ITEMS);
if (newSize < 0) {
xmlVErrMemory(ctxt);
return (0);
return (-1);
}
tmp = xmlRealloc(ctxt->nodeTab, newSize * sizeof(tmp[0]));
if (tmp == NULL) {
xmlVErrMemory(ctxt);
return (0);
return (-1);
}
ctxt->nodeTab = tmp;
ctxt->nodeMax = newSize;
@ -5110,7 +5110,10 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
*/
if ((cur->children != NULL) &&
(cur->children->children != NULL)) {
nodeVPush(ctxt, cur);
if (nodeVPush(ctxt, cur) < 0) {
xmlRegFreeExecCtxt(exec);
return(-1);
}
cur = cur->children->children;
continue;
}
@ -5214,7 +5217,11 @@ fail:
*/
if ((cur->children != NULL) &&
(cur->children->children != NULL)) {
nodeVPush(ctxt, cur);
if (nodeVPush(ctxt, cur) < 0) {
xmlFreeNodeList(repl);
ret = -1;
goto done;
}
cur = cur->children->children;
continue;
}
@ -5382,7 +5389,10 @@ xmlValidateOneCdataElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
*/
if ((cur->children != NULL) &&
(cur->children->children != NULL)) {
nodeVPush(ctxt, cur);
if (nodeVPush(ctxt, cur) < 0) {
ret = 0;
goto done;
}
cur = cur->children->children;
continue;
}