# New Ticket Created by  Jürgen Bömmels 
# Please include the string:  [perl #23040]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23040 >


Hi,

finally I found one of the double free errors in io.c:
At Parrot_exit the PIOs are destroyed and the buffer memory is
freed. Unfortunatly the pointer is not cleared, so if there is a
second PMC pointing to the same PIO the buffer is freed a second time.

Attached patch fixes this

bye
boe



-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/61326/45270/835a84/io15.diff

Index: io/io.c
===================================================================
RCS file: /cvs/public/parrot/io/io.c,v
retrieving revision 1.46
diff -u -r1.46 io.c
--- io/io.c	16 Jul 2003 05:46:23 -0000	1.46
+++ io/io.c	18 Jul 2003 17:46:20 -0000
@@ -100,8 +100,11 @@
     ParrotIO *io = PMC_data(pmc);
     UNUSED(interpreter);
 
-    if (io->b.startb && (io->b.flags & PIO_BF_MALLOC))
+    if (io->b.startb && (io->b.flags & PIO_BF_MALLOC)) {
         mem_sys_free(io->b.startb);
+        io->b.startb = NULL;
+        io->b.flags &= ~PIO_BF_MALLOC;
+    }
     mem_sys_free(io);
     PMC_data(pmc) = NULL;
     pmc->cache.struct_val = NULL;
-- 
Juergen Boemmels                        [EMAIL PROTECTED]
Fachbereich Physik                      Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern             Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47

Reply via email to