[svn:parrot] r40301 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Jul 28 08:11:54 UTC 2009


Author: chromatic
Date: Tue Jul 28 08:11:53 2009
New Revision: 40301
URL: https://trac.parrot.org/parrot/changeset/40301

Log:
[PMC] Rearranged code in Exception's destroy() vtable entry to check pointer
NULLness before dereferencing it (Coverity CID #408).

Modified:
   trunk/src/pmc/exception.pmc

Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc	Tue Jul 28 07:57:27 2009	(r40300)
+++ trunk/src/pmc/exception.pmc	Tue Jul 28 08:11:53 2009	(r40301)
@@ -175,10 +175,11 @@
 
     VTABLE void destroy() {
         Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF);
-        if (core_struct->thrower)
-            Parrot_free_context(interp, core_struct->thrower, 1);
-        if (core_struct)
+        if (core_struct) {
+            if (core_struct->thrower)
+                Parrot_free_context(interp, core_struct->thrower, 1);
             mem_sys_free(core_struct);
+        }
     }
 
 /*


More information about the parrot-commits mailing list