Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index c6ea6a4..65419de 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -33,6 +33,8 @@
     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;