[svn:parrot] r40303 - trunk/src

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Jul 28 08:35:01 UTC 2009


Author: chromatic
Date: Tue Jul 28 08:35:00 2009
New Revision: 40303
URL: https://trac.parrot.org/parrot/changeset/40303

Log:
[OO] Freed object attributes when created directly in Parrot_oo_clone_object();
this was a memory leak (Coverity CID #357).

Modified:
   trunk/src/oo.c

Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c	Tue Jul 28 08:17:16 2009	(r40302)
+++ trunk/src/oo.c	Tue Jul 28 08:35:00 2009	(r40303)
@@ -330,6 +330,10 @@
         }
     }
 
+    /* free object attributes if created directly */
+    if (!PMC_IS_NULL(dest))
+        mem_sys_free(obj);
+
     /* And we have ourselves a clone. */
     return cloned;
 }
@@ -338,10 +342,9 @@
 
 =item C<void * Parrot_oo_new_object_attrs(PARROT_INTERP, PMC * class_)>
 
-Create a new C<Parrot_Object_attributes> structure, which is the thing that
-holds data for an Object PMC. We need this for places where a new Object
-is being created without being instantiated by it's associated class, such
-as in C<Parrot_oo_clone_object>.
+Create a new C<Parrot_Object_attributes> structure to hold data for an Object
+PMC. We need this for places which create a new Object without instantiating it
+through its associated class, such as in C<Parrot_oo_clone_object>.
 
 =cut
 


More information about the parrot-commits mailing list