]> granicus.if.org Git - python/commitdiff
Try to handle a malloc failure. I'm not entirely sure this is correct.
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 12 Aug 2006 01:53:28 +0000 (01:53 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 12 Aug 2006 01:53:28 +0000 (01:53 +0000)
There might be something else we need to do to handle the exception.

Klocwork # 212-213

Modules/_sre.c

index 128bf9b6b67722f3eef496b126fbd03f2a261448..9e3a1e822b0421f3eb01547dbc7dd83900721bfd 100644 (file)
@@ -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;