diff --git a/psycopg/xid_type.c b/psycopg/xid_type.c index bc5e3ca5..b28543ca 100644 --- a/psycopg/xid_type.c +++ b/psycopg/xid_type.c @@ -78,7 +78,9 @@ static PyMemberDef xid_members[] = { static PyObject * 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); self->format_id = Py_None;