On Wed, 23 Jul 2003, Lars Balker Rasmussen wrote: > # New Ticket Created by Lars Balker Rasmussen > # Please include the string: [perl #23102] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23102 > > > > [i386, FreeBSD 5.0] > > Putting > > #include <assert.h> > #define mem_sys_free(x) do { assert(x != NULL); mem_sys_free(x); x = NULL; } > while (0) > > in include/parrot/memory.h caused an abort running pmc.t's > t/pmc/pmc_73.pasm, > > Assertion failed: ((pmc)->pmc_ext->data != NULL), function > Parrot_Scratchpad_destroy, file scratchpad.pmc, line 34. > > While freeing a null-pointer is legal, it's probably not intentional. >
This is because scratchpad's destroy method does: mem_sys_free(PMC_data(SELF)) without checking to see if the data pointer is NULL. The patch below should fix this. Simon Index: classes/scratchpad.pmc =================================================================== RCS file: /cvs/public/parrot/classes/scratchpad.pmc,v retrieving revision 1.10 diff -u -r1.10 scratchpad.pmc --- classes/scratchpad.pmc 21 Jul 2003 18:00:29 -0000 1.10 +++ classes/scratchpad.pmc 23 Jul 2003 23:10:16 -0000 @@ -31,7 +31,8 @@ } void destroy () { - mem_sys_free(PMC_data(SELF)); + if (PMC_data(SELF)) + mem_sys_free(PMC_data(SELF)); } STRING* name () {