[svn:parrot] r43307 - branches/boehm_gc/src/dynpmc

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Dec 29 10:31:15 UTC 2009


Author: bacek
Date: Tue Dec 29 10:31:15 2009
New Revision: 43307
URL: https://trac.parrot.org/parrot/changeset/43307

Log:
Fix free vs Parrot_str_free usage in Rational PMC. mpq_get_str doesn't allocate string using Parrot's mem_sys_allocate, so don't try to free is with mem_sys_free.

Modified:
   branches/boehm_gc/src/dynpmc/rational.pmc

Modified: branches/boehm_gc/src/dynpmc/rational.pmc
==============================================================================
--- branches/boehm_gc/src/dynpmc/rational.pmc	Tue Dec 29 10:30:52 2009	(r43306)
+++ branches/boehm_gc/src/dynpmc/rational.pmc	Tue Dec 29 10:31:15 2009	(r43307)
@@ -57,7 +57,7 @@
   #ifdef PARROT_HAS_GMP
     char * const cstr   = mpq_get_str(NULL, (int) base, RT(self));
     STRING * const pstr = Parrot_str_new(interp, cstr, 0);
-    Parrot_str_free_cstring(cstr);
+    free(cstr);
     return pstr;
   #else
     RAISE_EXCEPTION
@@ -267,7 +267,7 @@
         Parrot_Rational_attributes *attrs =
             mem_allocate_zeroed_typed(Parrot_Rational_attributes);
         PMC_data(SELF)     = attrs;
-        PMC_rational(SELF) = (RATIONAL *)malloc(sizeof (RATIONAL));
+        PMC_rational(SELF) = (RATIONAL *)mem_sys_allocate(sizeof (RATIONAL));
         mpq_init(RT(SELF));
         PObj_custom_destroy_SET(SELF);
       #endif


More information about the parrot-commits mailing list