1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

valid: Fix another use-after-free in xmlAddIDSafe

Short-lived regression.
This commit is contained in:
Nick Wellnhofer 2024-02-06 12:07:19 +01:00
parent 2963a097b9
commit 2807df9a4a

10
valid.c
View File

@ -2324,12 +2324,14 @@ xmlAddIDSafe(xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr,
/*
* Update the attribute to make entities work.
*/
if (ret->attr != NULL) {
ret->attr->id = NULL;
ret->attr = attr;
if (!streaming) {
if (ret->attr != NULL) {
ret->attr->id = NULL;
ret->attr = attr;
}
attr->id = ret;
}
attr->atype = XML_ATTRIBUTE_ID;
attr->id = ret;
return(0);
}
}