[libxml2] Don't call xmlXPathInit directly



commit 8b88503a2762edcc14d958f4a80149baffe95be7
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri Sep 18 19:15:27 2020 +0200

    Don't call xmlXPathInit directly
    
    Call xmlInitParser which uses a lock to avoid race conditions.
    
    Fixes #184.

 xpath.c    | 6 +++---
 xpointer.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index 2850a1ac2..311997fef 100644
--- a/xpath.c
+++ b/xpath.c
@@ -14234,7 +14234,7 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
         return(comp);
 #endif
 
-    xmlXPathInit();
+    xmlInitParser();
 
     pctxt = xmlXPathNewParserContext(str, ctxt);
     if (pctxt == NULL)
@@ -14323,7 +14323,7 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp,
 
     if (comp == NULL)
        return(-1);
-    xmlXPathInit();
+    xmlInitParser();
 
 #ifndef LIBXML_THREAD_ENABLED
     reentance++;
@@ -14468,7 +14468,7 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
 
     CHECK_CTXT(ctx)
 
-    xmlXPathInit();
+    xmlInitParser();
 
     ctxt = xmlXPathNewParserContext(str, ctx);
     if (ctxt == NULL)
diff --git a/xpointer.c b/xpointer.c
index 39f4ac762..53def7289 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -1352,7 +1352,7 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) {
     xmlXPathObjectPtr init = NULL;
     int stack = 0;
 
-    xmlXPathInit();
+    xmlInitParser();
 
     if ((ctx == NULL) || (str == NULL))
        return(NULL);


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