diff Python/symtable.c @ 45772:fea7ba8910a9 legacy-trunk

Handle memory allocation failure. Found by Adam Olsen
author Neal Norwitz <nnorwitz@gmail.com>
date Sat, 15 Mar 2008 22:36:01 +0000
parents 393822f2ef90
children 2ff88ae9850c
line wrap: on
line diff
--- a/Python/symtable.c	Sat Mar 15 22:03:18 2008 +0000
+++ b/Python/symtable.c	Sat Mar 15 22:36:01 2008 +0000
@@ -27,8 +27,9 @@
 	k = PyLong_FromVoidPtr(key);
 	if (k == NULL)
 		goto fail;
-	ste = (PySTEntryObject *)PyObject_New(PySTEntryObject,
-					      &PySTEntry_Type);
+	ste = PyObject_New(PySTEntryObject, &PySTEntry_Type);
+	if (ste == NULL)
+		goto fail;
 	ste->ste_table = st;
 	ste->ste_id = k;
 	ste->ste_tmpname = 0;