]> granicus.if.org Git - python/commitdiff
Handle memory allocation failure. Found by Adam Olsen
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 15 Mar 2008 22:36:01 +0000 (22:36 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 15 Mar 2008 22:36:01 +0000 (22:36 +0000)
Python/symtable.c

index 56e187a7d156c795659b0e01fcca5294c8ddd466..6318324d5c9b5bbbf4a216f41b55610aca0b3d18 100644 (file)
@@ -27,8 +27,9 @@ PySTEntry_New(struct symtable *st, identifier name, _Py_block_ty block,
        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;