[Python-checkins] r52146 - python/branches/release24-maint/Modules/_sre.c

andrew.kuchling python-checkins at python.org
Wed Oct 4 15:30:18 CEST 2006


Author: andrew.kuchling
Date: Wed Oct 4 15:30:17 2006
New Revision: 52146
Modified:
 python/branches/release24-maint/Modules/_sre.c
Log:
[Backport r51225 | neal.norwitz]
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
[I think this needs more work; a malloc() failure will cause a match to fail,
 but nothing raises MemoryError. I'll work on this on the trunk and backport.
 --amk]
Modified: python/branches/release24-maint/Modules/_sre.c
==============================================================================
--- python/branches/release24-maint/Modules/_sre.c	(original)
+++ python/branches/release24-maint/Modules/_sre.c	Wed Oct 4 15:30:17 2006
@@ -1162,6 +1162,9 @@
 
 /* install new repeat context */
 ctx->u.rep = (SRE_REPEAT*) 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

AltStyle によって変換されたページ (->オリジナル) /