]> granicus.if.org Git - python/commitdiff
Move the initialization of some pointers earlier. The problem is
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 21 Jul 2006 05:31:02 +0000 (05:31 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 21 Jul 2006 05:31:02 +0000 (05:31 +0000)
that if we call Py_DECREF(frame) like we do if allocating locals fails,
frame_dealloc() will try to use these bogus values and crash.

Objects/frameobject.c

index a933c4a6912ffbf6f9cfb3b79b2b0811a467fe75..3a073b6fa02a2e1f6ec37b9d9e60dbe1e74d801e 100644 (file)
@@ -642,6 +642,7 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
                f->f_trace = NULL;
                 f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL;
        }
+       f->f_stacktop = f->f_valuestack;
        f->f_builtins = builtins;
        Py_XINCREF(back);
        f->f_back = back;
@@ -672,7 +673,6 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
        f->f_lineno = code->co_firstlineno;
        f->f_iblock = 0;
 
-        f->f_stacktop = f->f_valuestack;
        _PyObject_GC_TRACK(f);
        return f;
 }