Guard from NULL dereference if Xid allocation fails

This commit is contained in:
Daniele Varrazzo 2012-03-04 04:39:41 +00:00
parent 31812c01e6
commit 18085201c8

View File

@ -78,7 +78,9 @@ static PyMemberDef xid_members[] = {
static PyObject * static PyObject *
xid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) xid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{ {
XidObject *self = (XidObject *)type->tp_alloc(type, 0); XidObject *self;
if (!(self = (XidObject *)type->tp_alloc(type, 0))) { return NULL; }
Py_INCREF(Py_None); Py_INCREF(Py_None);
self->format_id = Py_None; self->format_id = Py_None;