Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Avoid leaks by calling Py_DECREF in some code paths
  • Loading branch information
kaushikcfd committed Nov 5, 2022
commit 6ae052ef771eb9e72f7cbb90b58a2bb1d10ae3f5
9 changes: 7 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4881,10 +4881,15 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
joined = PyUnicode_Join(comma_w_quotes_sep, sorted_methods);
method_count = PyObject_Length(sorted_methods);
Py_DECREF(sorted_methods);
if (joined == NULL)
if (joined == NULL) {
Py_DECREF(comma_w_quotes_sep);
return NULL;
if (method_count == -1)
}
if (method_count == -1) {
Py_DECREF(comma_w_quotes_sep);
Py_DECREF(joined);
return NULL;
}

PyErr_Format(PyExc_TypeError,
"Can't instantiate abstract class %s "
Expand Down