From 6b962860e2bd2d08d8d5d38969ed4864f8c1219a Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Sun, 19 Aug 2012 11:20:41 +0200 Subject: [PATCH] Check for NULL return value in PyStructSequence_NewType(). Found by Coverity. --- Objects/structseq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/structseq.c b/Objects/structseq.c index 28cbb1901f4..c3b9a72989a 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -383,6 +383,8 @@ PyTypeObject* PyStructSequence_NewType(PyStructSequence_Desc *desc) { PyTypeObject *result = (PyTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); - PyStructSequence_InitType(result, desc); + if (result != NULL) { + PyStructSequence_InitType(result, desc); + } return result; }