diff src/context.cpp @ 158:22d46b688ace

Resolved 2 TODOs.
author Atul Varma <varmaa@toolness.com>
date Sun, 30 Aug 2009 15:10:07 -0700
parents a31ff2de6017
children d1606a6cf1c0
line wrap: on
line diff
--- a/src/context.cpp	Sun Aug 30 15:06:10 2009 -0700
+++ b/src/context.cpp	Sun Aug 30 15:10:07 2009 -0700
@@ -160,7 +160,7 @@
       if (JS_GetScriptObject(script)) {
         pyScript = (PyObject *) PYM_newJSScript(self, script);
         if (pyScript == NULL) {
-          // TODO: We should clean up here.
+          Py_XDECREF(top);
           return NULL;
         }
       }
@@ -175,7 +175,8 @@
     if (funObj) {
       pyFunc = (PyObject *) PYM_newJSObject(self, funObj, NULL);
       if (pyFunc == NULL) {
-        // TODO: We should clean up here.
+        Py_XDECREF(top);
+        Py_DECREF(pyScript);
         return NULL;
       }
     } else {