mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-23 02:50:08 +03:00
Fix xmlSchemaValidCtxtPtr reuse memory leak
When reusing an xmlSchemaValidCtxtPtr to validate multiple xml documents against the same schema, there is a memory leak in xmlschemas.c in xmlSchemaClearValidCtxt(). The vctxt->idcKeys and associated counters are not cleaned up in xmlSchemaClearValidCtxt() as they are in xmlSchemaFreeValidCtxt(). As a result, vctxt->idcKeys grows with each xmlValidateDoc() call that uses the same context and that memory is never freed. Similarly, vctxt->nbIdcKeys and vctxt->sizeIdcKeys increment and are never reset. Closes: #23
This commit is contained in:
parent
1dafb427d9
commit
b697d7bb59
11
xmlschemas.c
11
xmlschemas.c
@ -27653,6 +27653,17 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
|
||||
vctxt->nbIdcNodes = 0;
|
||||
vctxt->sizeIdcNodes = 0;
|
||||
}
|
||||
|
||||
if (vctxt->idcKeys != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < vctxt->nbIdcKeys; i++)
|
||||
xmlSchemaIDCFreeKey(vctxt->idcKeys[i]);
|
||||
xmlFree(vctxt->idcKeys);
|
||||
vctxt->idcKeys = NULL;
|
||||
vctxt->nbIdcKeys = 0;
|
||||
vctxt->sizeIdcKeys = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that we won't delete the XPath state pool here.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user