[Python-checkins] r52119 - python/branches/release24-maint/Modules/expat/xmlparse.c

andrew.kuchling python-checkins at python.org
Tue Oct 3 21:33:56 CEST 2006


Author: andrew.kuchling
Date: Tue Oct  3 21:33:56 2006
New Revision: 52119

Modified:
   python/branches/release24-maint/Modules/expat/xmlparse.c
Log:
[backport r51253 | neal.norwitz]

Handle failures from lookup.

Klocwork 341-342




Modified: python/branches/release24-maint/Modules/expat/xmlparse.c
==============================================================================
--- python/branches/release24-maint/Modules/expat/xmlparse.c	(original)
+++ python/branches/release24-maint/Modules/expat/xmlparse.c	Tue Oct  3 21:33:56 2006
@@ -2784,6 +2784,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;
@@ -5259,6 +5261,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