1From 7ffcd44d7e6c46704f8af0321d9314cd26e0e18a Mon Sep 17 00:00:00 2001
2From: Zhipeng Xie <xiezhipeng1@huawei.com>
3Date: Tue, 20 Aug 2019 16:33:06 +0800
4Subject: [PATCH] Fix memory leak in xmlSchemaValidateStream
5
6When ctxt->schema is NULL, xmlSchemaSAXPlug->xmlSchemaPreRun
7alloc a new schema for ctxt->schema and set vctxt->xsiAssemble
8to 1. Then xmlSchemaVStart->xmlSchemaPreRun initialize
9vctxt->xsiAssemble to 0 again which cause the alloced schema
10can not be freed anymore.
11
12Found with libFuzzer.
13
14Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
15---
16 xmlschemas.c | 1 -
17 1 file changed, 1 deletion(-)
18
19diff --git misc/libxml2-2.9.10/xmlschemas.c misc/build/libxml2-2.9.10/xmlschemas.c
20index 301c84499..39d92182f 100644
21--- misc/libxml2-2.9.10/xmlschemas.c
22+++ misc/build/libxml2-2.9.10/xmlschemas.c
23@@ -28090,7 +28090,6 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
24     vctxt->nberrors = 0;
25     vctxt->depth = -1;
26     vctxt->skipDepth = -1;
27-    vctxt->xsiAssemble = 0;
28     vctxt->hasKeyrefs = 0;
29 #ifdef ENABLE_IDC_NODE_TABLES_TEST
30     vctxt->createIDCNodeTables = 1;
31--
32GitLab
33
34