]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[backport r51253 | neal.norwitz]
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 19:33:56 +0000 (19:33 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 19:33:56 +0000 (19:33 +0000)
Handle failures from lookup.

Klocwork 341-342

Modules/expat/xmlparse.c

index 19a83ddc361e4c81417df313c45071ff3057cf48..388dff880dbb07c72af70040e172ae3e14740c5b 100644 (file)
@@ -2784,6 +2784,8 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
         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 @@ getAttributeId(XML_Parser parser, const ENCODING *enc,
             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