]> granicus.if.org Git - python/commitdiff
PyType_stgdict() returns a borrowed reference which must not be Py_DECREF'd.
authorThomas Heller <theller@ctypes.org>
Wed, 11 Jul 2007 12:18:46 +0000 (12:18 +0000)
committerThomas Heller <theller@ctypes.org>
Wed, 11 Jul 2007 12:18:46 +0000 (12:18 +0000)
This bug should be fixed in trunk and release25-maint also.

Modules/_ctypes/stgdict.c

index 07e142bdfe0675a0b01b0fc5904c12492578d160..c35a5154e965d58790d9b85e360448e0fa62f988 100644 (file)
@@ -465,13 +465,11 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct)
 
                if (!prop) {
                        Py_DECREF(pair);
-                       Py_DECREF((PyObject *)stgdict);
                        return -1;
                }
                if (-1 == PyDict_SetItem(realdict, name, prop)) {
                        Py_DECREF(prop);
                        Py_DECREF(pair);
-                       Py_DECREF((PyObject *)stgdict);
                        return -1;
                }
                Py_DECREF(pair);