From 50f18830e179f273c244d4969485c4154c81cc01 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 21 Jun 2020 15:21:45 +0200
Subject: [PATCH 058/139] Fix another memory leak in xmlSchemaValAtomicType

Don't collapse language IDs twice.

Found with libFuzzer and ASan.
---
 xmlschemastypes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 1a44052..35edfd6 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -2636,7 +2636,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
                 goto return0;
             }
         case XML_SCHEMAS_LANGUAGE:
-	    if (normOnTheFly) {
+	    if ((norm == NULL) && (normOnTheFly)) {
 		norm = xmlSchemaCollapseString(value);
 		if (norm != NULL)
 		    value = norm;
-- 
1.8.3.1

