Under -Dmad, free the ops representing the dead code when a branch
Nicholas Clark [Fri, 16 Mar 2007 19:29:04 +0000 (19:29 +0000)]
conditional value is actually a constant. Previously this was leaking
ops, and more visibly shared hash keys.

p4raw-id: //depot/perl@30605

op.c

diff --git a/op.c b/op.c
index 7c649fc..981b765 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4246,12 +4246,12 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop)
                trueop = newUNOP(OP_NULL, 0, trueop);
                op_getmad(first,trueop,'C');
                op_getmad(falseop,trueop,'e');
-           }
-           /* FIXME for MAD - should there be an ELSE here?  */
-#else
-           op_free(first);
-           op_free(falseop);
+           } else
 #endif
+           {
+               op_free(first);
+               op_free(falseop);
+           }
            return trueop;
        }
        else {
@@ -4260,12 +4260,12 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop)
                falseop = newUNOP(OP_NULL, 0, falseop);
                op_getmad(first,falseop,'C');
                op_getmad(trueop,falseop,'t');
-           }
-           /* FIXME for MAD - should there be an ELSE here?  */
-#else
-           op_free(first);
-           op_free(trueop);
+           } else
 #endif
+           {
+               op_free(first);
+               op_free(trueop);
+           }
            return falseop;
        }
     }