[libxml2] Fix memory leak in xmlXPathNodeSetMergeAndClear



commit 9d08b347162ca3916984f05c907e968aea28b3ed
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun May 21 16:46:12 2017 +0200

    Fix memory leak in xmlXPathNodeSetMergeAndClear
    
    Namespaces nodes must not be duplicated when merging.
    
    Found with libFuzzer and ASan.

 xpath.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index 9c1478e..ec4d685 100644
--- a/xpath.c
+++ b/xpath.c
@@ -4021,13 +4021,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2,
                set1->nodeTab = temp;
                set1->nodeMax *= 2;
            }
-           if (n2->type == XML_NAMESPACE_DECL) {
-               xmlNsPtr ns = (xmlNsPtr) n2;
-
-               set1->nodeTab[set1->nodeNr++] =
-                   xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
-           } else
-               set1->nodeTab[set1->nodeNr++] = n2;
+           set1->nodeTab[set1->nodeNr++] = n2;
 skip_node:
            {}
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]