[Python-checkins] cpython (3.2): Check for NULL return value in PyStructSequence_NewType(). Found by Coverity.

stefan.krah python-checkins at python.org
Sun Aug 19 11:27:22 CEST 2012


http://hg.python.org/cpython/rev/f5e0561e9aa9
changeset:   78648:f5e0561e9aa9
branch:      3.2
parent:      78646:a225a27b0860
user:        Stefan Krah <skrah at bytereef.org>
date:        Sun Aug 19 11:20:41 2012 +0200
summary:
  Check for NULL return value in PyStructSequence_NewType(). Found by Coverity.

files:
  Objects/structseq.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Objects/structseq.c b/Objects/structseq.c
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -383,6 +383,8 @@
 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;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list