develooper Front page | perl.perl5.porters | Postings from September 1999

[PATCH 5.005_61] regfree could segfault with -Mre=debug

Thread Previous
From:
Ilya Zakharevich
Date:
September 21, 1999 16:50
Subject:
[PATCH 5.005_61] regfree could segfault with -Mre=debug
Message ID:
19990921195000.A23938@monk.mps.ohio-state.edu
--- ./regcomp.c~	Fri Sep 10 10:10:43 1999
+++ ./regcomp.c	Tue Sep 21 18:46:49 1999
@@ -3287,6 +3287,9 @@ Perl_pregfree(pTHX_ struct regexp *r)
 {
     dTHR;
     DEBUG_r(if (!PL_colorset) reginitcolors());
+
+    if (!r || (--r->refcnt > 0))
+	return;
     DEBUG_r(PerlIO_printf(Perl_debug_log,
 		      "%sFreeing REx:%s `%s%.60s%s%s'\n",
 		      PL_colors[4],PL_colors[5],PL_colors[0],
@@ -3294,9 +3297,6 @@ Perl_pregfree(pTHX_ struct regexp *r)
 		      PL_colors[1],
 		      (strlen(r->precomp) > 60 ? "..." : "")));
 
-
-    if (!r || (--r->refcnt > 0))
-	return;
     if (r->precomp)
 	Safefree(r->precomp);
     if (RX_MATCH_COPIED(r))

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About