[Python-checkins] r51225 - python/trunk/Modules/_sre.c

neal.norwitz python-checkins at python.org
Sat Aug 12 03:53:29 CEST 2006


Author: neal.norwitz
Date: Sat Aug 12 03:53:28 2006
New Revision: 51225

Modified:
   python/trunk/Modules/_sre.c
Log:
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


Modified: python/trunk/Modules/_sre.c
==============================================================================
--- python/trunk/Modules/_sre.c	(original)
+++ python/trunk/Modules/_sre.c	Sat Aug 12 03:53:28 2006
@@ -1166,6 +1166,9 @@
 
             /* 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;


More information about the Python-checkins mailing list