[Python-checkins] r51253 - python/trunk/Modules/expat/xmlparse.c

neal.norwitz python-checkins at python.org
Sun Aug 13 20:12:27 CEST 2006


Author: neal.norwitz
Date: Sun Aug 13 20:12:26 2006
New Revision: 51253

Modified:
   python/trunk/Modules/expat/xmlparse.c
Log:
Handle failures from lookup.

Klocwork 341-342



Modified: python/trunk/Modules/expat/xmlparse.c
==============================================================================
--- python/trunk/Modules/expat/xmlparse.c	(original)
+++ python/trunk/Modules/expat/xmlparse.c	Sun Aug 13 20:12:26 2006
@@ -2795,6 +2795,8 @@
         unsigned long uriHash = 0;
         ((XML_Char *)s)[-1] = 0;  /* clear flag */
         id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, s, 0);
+        if (!id)
+          return XML_ERROR_NO_MEMORY;
         b = id->prefix->binding;
         if (!b)
           return XML_ERROR_UNBOUND_PREFIX;
@@ -5340,6 +5342,8 @@
             return NULL;
           id->prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&dtd->pool),
                                         sizeof(PREFIX));
+          if (!id->prefix)
+            return NULL;
           if (id->prefix->name == poolStart(&dtd->pool))
             poolFinish(&dtd->pool);
           else


More information about the Python-checkins mailing list