File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4509,8 +4509,10 @@ add_members(PyTypeObject *type, PyMemberDef *memb)
45094509 descr = PyDescr_NewMember (type , memb );
45104510 if (descr == NULL )
45114511 return -1 ;
4512- if (PyDict_SetItemString (dict , memb -> name , descr ) < 0 )
4512+ if (PyDict_SetItemString (dict , memb -> name , descr ) < 0 ) {
4513+ Py_DECREF (descr );
45134514 return -1 ;
4515+ }
45144516 Py_DECREF (descr );
45154517 }
45164518 return 0 ;
@@ -4529,8 +4531,10 @@ add_getset(PyTypeObject *type, PyGetSetDef *gsp)
45294531
45304532 if (descr == NULL )
45314533 return -1 ;
4532- if (PyDict_SetItemString (dict , gsp -> name , descr ) < 0 )
4534+ if (PyDict_SetItemString (dict , gsp -> name , descr ) < 0 ) {
4535+ Py_DECREF (descr );
45334536 return -1 ;
4537+ }
45344538 Py_DECREF (descr );
45354539 }
45364540 return 0 ;
@@ -7010,8 +7014,10 @@ add_operators(PyTypeObject *type)
70107014 descr = PyDescr_NewWrapper (type , p , * ptr );
70117015 if (descr == NULL )
70127016 return -1 ;
7013- if (PyDict_SetItem (dict , p -> name_strobj , descr ) < 0 )
7017+ if (PyDict_SetItem (dict , p -> name_strobj , descr ) < 0 ) {
7018+ Py_DECREF (descr );
70147019 return -1 ;
7020+ }
70157021 Py_DECREF (descr );
70167022 }
70177023 }
You can’t perform that action at this time.
0 commit comments