summaryrefslogtreecommitdiffstats
path: root/Modules/expat/xmlparse.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-13 18:12:26 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-13 18:12:26 (GMT)
commit26a8abf1f47ba14e9b965e351cef9cd238256f4c (patch)
treeace6e686d75ea207ec30df08951e5fc2fcb539e6 /Modules/expat/xmlparse.c
parentee7c8f9af80ac2fa76987ca25397624915cbaea4 (diff)
downloadcpython-26a8abf1f47ba14e9b965e351cef9cd238256f4c.zip
cpython-26a8abf1f47ba14e9b965e351cef9cd238256f4c.tar.gz
cpython-26a8abf1f47ba14e9b965e351cef9cd238256f4c.tar.bz2
Handle failures from lookup.
Klocwork 341-342
Diffstat (limited to 'Modules/expat/xmlparse.c')
-rw-r--r--Modules/expat/xmlparse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c
index 882470d..e04426d 100644
--- a/Modules/expat/xmlparse.c
+++ b/Modules/expat/xmlparse.c
@@ -2795,6 +2795,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;
@@ -5340,6 +5342,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