develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [ID 20010822.001] Freeing pads after parse error

Thread Previous | Thread Next
From:
Simon Cozens
Date:
August 23, 2001 04:06
Subject:
Re: [ID 20010822.001] Freeing pads after parse error
Message ID:
20010823120636.A9961@netthink.co.uk
On Wed, Aug 22, 2001 at 10:25:44AM +0100, Simon Cozens wrote:
> This segfaults, without an error message. I think it is something
> to do with the save stack and PL_comppad.

Yes. On error, Perl is unwinding the save stack too many times,
meaning that PL_comppad is at the wrong level. This causes Perl
to try to free an op from an element of PL_comppad that isn't
there any more. Here's a patch.

--- op.c~~	Mon Aug 13 01:30:59 2001
+++ op.c	Thu Aug 23 12:04:03 2001
@@ -2147,7 +2147,8 @@
 {
     int needblockscope = PL_hints & HINT_BLOCK_SCOPE;
     OP* retval = scalarseq(seq);
-    LEAVE_SCOPE(floor);
+    if (!PL_error_count)
+        LEAVE_SCOPE(floor);
     PL_pad_reset_pending = FALSE;
     PL_compiling.op_private = PL_hints;
     if (needblockscope)

Simon

Thread Previous | Thread Next


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