Skip to content

Commit

Permalink
Fix a possible crash due to PyType_FromSpecWithBases() (GH-10304)
Browse files Browse the repository at this point in the history
If the PyObject_MALLOC() call failed in PyType_FromSpecWithBases(),
PyObject_Free() would be called on a static string in type_dealloc().
  • Loading branch information
ZackerySpytz authored and encukou committed May 9, 2019
1 parent e657624 commit 0613c1e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
size_t len = strlen(old_doc)+1;
char *tp_doc = PyObject_MALLOC(len);
if (tp_doc == NULL) {
type->tp_doc = NULL;
PyErr_NoMemory();
goto fail;
}
Expand Down

0 comments on commit 0613c1e

Please sign in to comment.