This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Call cop_free on nullified cops too
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 15 Apr 2008 15:54:31 +0000 (15:54 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 15 Apr 2008 15:54:31 +0000 (15:54 +0000)
(this is a followup to 33687)

p4raw-id: //depot/perl@33695

op.c

diff --git a/op.c b/op.c
index 6823cc9..ba9e2a5 100644 (file)
--- a/op.c
+++ b/op.c
@@ -502,7 +502,10 @@ Perl_op_free(pTHX_ OP *o)
 
     /* COP* is not cleared by op_clear() so that we may track line
      * numbers etc even after null() */
 
     /* COP* is not cleared by op_clear() so that we may track line
      * numbers etc even after null() */
-    if (type == OP_NEXTSTATE || type == OP_DBSTATE) {
+    if (type == OP_NEXTSTATE || type == OP_DBSTATE
+           || (type == OP_NULL /* the COP might have been null'ed */
+               && ((OPCODE)o->op_targ == OP_NEXTSTATE
+                   || (OPCODE)o->op_targ == OP_DBSTATE))) {
        cop_free((COP*)o);
     }
 
        cop_free((COP*)o);
     }