From: Nicholas Clark Date: Sat, 29 May 2010 21:07:04 +0000 (+0100) Subject: Properly free paren_name_list with its regexp. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=af534a0431cd837092de9abe4bff29feeeafebb3;p=p5sagit%2Fp5-mst-13.2.git Properly free paren_name_list with its regexp. Previously the AV paren_name_list would "leak" until global destruction. This was only an issue under -DDEBUGGING. Fixes RT #73438. --- diff --git a/regcomp.c b/regcomp.c index ff9c582..0a343ec 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4945,7 +4945,7 @@ reStudy: #endif #ifdef DEBUGGING if (RExC_paren_names) { - ri->name_list_idx = add_data( pRExC_state, 1, "p" ); + ri->name_list_idx = add_data( pRExC_state, 1, "a" ); ri->data->data[ri->name_list_idx] = (void*)SvREFCNT_inc(RExC_paren_name_list); } else #endif @@ -9556,6 +9556,7 @@ Perl_regfree_internal(pTHX_ REGEXP * const rx) while (--n >= 0) { /* If you add a ->what type here, update the comment in regcomp.h */ switch (ri->data->what[n]) { + case 'a': case 's': case 'S': case 'u': @@ -9789,8 +9790,9 @@ Perl_regdupe_internal(pTHX_ REGEXP * const rx, CLONE_PARAMS *param) for (i = 0; i < count; i++) { d->what[i] = ri->data->what[i]; switch (d->what[i]) { - /* legal options are one of: sSfpontTu + /* legal options are one of: sSfpontTua see also regcomp.h and pregfree() */ + case 'a': /* actually an AV, but the dup function is identical. */ case 's': case 'S': case 'p': /* actually an AV, but the dup function is identical. */ diff --git a/regcomp.h b/regcomp.h index ad9a2cc..1ef9d2d 100644 --- a/regcomp.h +++ b/regcomp.h @@ -476,6 +476,7 @@ END_EXTERN_C /* .what is a character array with one character for each member of .data * The character describes the function of the corresponding .data item: + * a - AV for paren_name_list under DEBUGGING * f - start-class data for regstclass optimization * n - Root of op tree for (?{EVAL}) item * o - Start op for (?{EVAL}) item