This repository was archived by the owner on Feb 13, 2025. It is now read-only.
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 @@ -4556,8 +4556,10 @@ add_members(PyTypeObject *type, PyMemberDef *memb)
4556
4556
descr = PyDescr_NewMember (type , memb );
4557
4557
if (descr == NULL )
4558
4558
return -1 ;
4559
- if (PyDict_SetItemString (dict , memb -> name , descr ) < 0 )
4559
+ if (PyDict_SetItemString (dict , memb -> name , descr ) < 0 ) {
4560
+ Py_DECREF (descr );
4560
4561
return -1 ;
4562
+ }
4561
4563
Py_DECREF (descr );
4562
4564
}
4563
4565
return 0 ;
@@ -4576,8 +4578,10 @@ add_getset(PyTypeObject *type, PyGetSetDef *gsp)
4576
4578
4577
4579
if (descr == NULL )
4578
4580
return -1 ;
4579
- if (PyDict_SetItemString (dict , gsp -> name , descr ) < 0 )
4581
+ if (PyDict_SetItemString (dict , gsp -> name , descr ) < 0 ) {
4582
+ Py_DECREF (descr );
4580
4583
return -1 ;
4584
+ }
4581
4585
Py_DECREF (descr );
4582
4586
}
4583
4587
return 0 ;
@@ -7319,8 +7323,10 @@ add_operators(PyTypeObject *type)
7319
7323
d -> d_slpmask = ((signed char * ) type -> tp_as_mapping )[p -> slp_offset ];
7320
7324
}
7321
7325
#endif
7322
- if (PyDict_SetItem (dict , p -> name_strobj , descr ) < 0 )
7326
+ if (PyDict_SetItem (dict , p -> name_strobj , descr ) < 0 ) {
7327
+ Py_DECREF (descr );
7323
7328
return -1 ;
7329
+ }
7324
7330
Py_DECREF (descr );
7325
7331
}
7326
7332
}
You can’t perform that action at this time.
0 commit comments