Add some missing NULL checks which trigger crashes on low-memory conditions.

Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
This commit is contained in:
Georg Brandl 2007-04-11 17:16:24 +00:00
parent 5bf02cd17f
commit c02e13122b
2 changed files with 10 additions and 0 deletions

View file

@ -33,6 +33,8 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyBaseExceptionObject *self;
self = (PyBaseExceptionObject *)type->tp_alloc(type, 0);
if (!self)
return NULL;
/* the dict is created on the fly in PyObject_GenericSetAttr */
self->message = self->dict = NULL;