From ef0de023db9bc520312e5f0f59bbc9a47f0f204e Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sat, 12 Aug 2006 01:53:28 +0000 Subject: 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 --- Modules/_sre.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v0.12