[libxml2] Remove useless check in xmlParseAttributeListDecl



commit 4ba8cc856bd2d11f3c500a27bca7b56d826a19b6
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sat Jun 10 02:33:58 2017 +0200

    Remove useless check in xmlParseAttributeListDecl
    
    Since we already successfully parsed the attribute name and other
    items, it is guaranteed that we made progress in the input stream.
    
    Comparing the input pointer to a previous value also looks fragile to
    me. What if the input buffer was reallocated and the new "cur" pointer
    happens to be the same as the old one? There are a couple of similar
    checks which also take "consumed" into account. This seems to be safer
    but I'm not convinced that it couldn't lead to false alarms in rare
    situations.

 parser.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
---
diff --git a/parser.c b/parser.c
index d07d3e6..781aa0c 100644
--- a/parser.c
+++ b/parser.c
@@ -6107,7 +6107,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
        SKIP_BLANKS;
        GROW;
        while ((RAW != '>') && (ctxt->instate != XML_PARSER_EOF)) {
-           const xmlChar *check = CUR_PTR;
            int type;
            int def;
            xmlChar *defaultValue = NULL;
@@ -6167,15 +6166,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
                }
                SKIP_BLANKS;
            }
-           if (check == CUR_PTR) {
-               xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
-                           "in xmlParseAttributeListDecl\n");
-               if (defaultValue != NULL)
-                   xmlFree(defaultValue);
-               if (tree != NULL)
-                   xmlFreeEnumeration(tree);
-               break;
-           }
            if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
                (ctxt->sax->attributeDecl != NULL))
                ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,


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