[libxml2] Fix memory leak in xmlXPathCompareNodeSetValue



commit cf60dbe461966f40fece3737f95859144b1d452d
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Thu May 25 16:20:56 2017 +0200

    Fix memory leak in xmlXPathCompareNodeSetValue
    
    Implement TODO block to free the arguments in error case.
    
    Found with libFuzzer and ASan.

 xpath.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index ec4d685..22cfdc0 100644
--- a/xpath.c
+++ b/xpath.c
@@ -6709,7 +6709,13 @@ xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
            valuePush(ctxt, val);
            return(xmlXPathCompareValues(ctxt, inf, strict));
        default:
-           TODO
+            xmlGenericError(xmlGenericErrorContext,
+                    "xmlXPathCompareNodeSetValue: Can't compare node set "
+                    "and object of type %d\n",
+                    val->type);
+            xmlXPathReleaseObject(ctxt->context, arg);
+            xmlXPathReleaseObject(ctxt->context, val);
+            XP_ERROR0(XPATH_INVALID_TYPE);
     }
     return(0);
 }


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