summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-12 01:53:28 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-12 01:53:28 (GMT)
commitef0de023db9bc520312e5f0f59bbc9a47f0f204e (patch)
treef7f44f44c9260c015b34fee407981d5a0529afd4 /Modules/_sre.c
parent9cd3c34b6aaf189bd47849d0b0511234845940aa (diff)
downloadcpython-ef0de023db9bc520312e5f0f59bbc9a47f0f204e.zip
cpython-ef0de023db9bc520312e5f0f59bbc9a47f0f204e.tar.gz
cpython-ef0de023db9bc520312e5f0f59bbc9a47f0f204e.tar.bz2
Try to handle a malloc failure. I'm not entirely sure this is correct.
There might be something else we need to do to handle the exception. Klocwork # 212-213
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 128bf9b..9e3a1e8 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -1166,6 +1166,9 @@ entrance:
/* install new repeat context */
ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));
+ /* XXX(nnorwitz): anything else we need to do on error? */
+ if (!ctx->u.rep)
+ RETURN_FAILURE;
ctx->u.rep->count = -1;
ctx->u.rep->pattern = ctx->pattern;
ctx->u.rep->prev = state->repeat;