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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Jul 28 07:45:00 UTC 2009


Author: chromatic
Date: Tue Jul 28 07:44:59 2009
New Revision: 40298
URL: https://trac.parrot.org/parrot/changeset/40298

Log:
[PMC] Avoided dereferencing a potentially NULL pointer before checking for
NULLness in Continuation's caller() method (Coverity CID #409).

Modified:
   trunk/src/pmc/continuation.pmc

Modified: trunk/src/pmc/continuation.pmc
==============================================================================
--- trunk/src/pmc/continuation.pmc	Tue Jul 28 07:01:31 2009	(r40297)
+++ trunk/src/pmc/continuation.pmc	Tue Jul 28 07:44:59 2009	(r40298)
@@ -304,9 +304,13 @@
         PMC         *caller = cc->to_ctx->current_sub;
         Parrot_sub  *sub;
 
-        PMC_get_sub(INTERP, caller, sub);
-        if (!caller || !sub->seg)
+        if (!caller)
             caller = PMCNULL;
+        else {
+            PMC_get_sub(INTERP, caller, sub);
+            if (!sub->seg)
+                caller = PMCNULL;
+        }
 
         RETURN(PMC *caller);
 


More information about the parrot-commits mailing list