From: Yves Orton Date: Thu, 28 Jun 2007 00:01:54 +0000 (+0000) Subject: Free memory in case of error/failure to compile. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8075761208a85389a282fb4cad97452cfca4af30;p=p5sagit%2Fp5-mst-13.2.git Free memory in case of error/failure to compile. Hopefully valgrind will notice and like. :-) p4raw-id: //depot/perl@31483 --- diff --git a/regcomp.c b/regcomp.c index 5df69d4..4e146b7 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4321,9 +4321,10 @@ redo_first_pass: /* Store the count of eval-groups for security checks: */ RExC_rx->seen_evals = RExC_seen_evals; REGC((U8)REG_MAGIC, (char*) RExC_emit++); - if (reg(pRExC_state, 0, &flags,1) == NULL) + if (reg(pRExC_state, 0, &flags,1) == NULL) { + ReREFCNT_dec(r); return(NULL); - + } /* XXXX To minimize changes to RE engine we always allocate 3-units-long substrs field. */ Newx(r->substrs, 1, struct reg_substr_data);