]> granicus.if.org Git - python/commitdiff
Handle more mem alloc issues found with failmalloc
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 23 Jul 2006 07:50:36 +0000 (07:50 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 23 Jul 2006 07:50:36 +0000 (07:50 +0000)
Python/future.c
Python/symtable.c

index 560077d4d06812e4cf521665c0662b8bb7dfaac9..3b3ca1d7ba469e277774a5d5c7e5685588b1615d 100644 (file)
@@ -121,8 +121,10 @@ PyFuture_FromAST(mod_ty mod, const char *filename)
        PyFutureFeatures *ff;
 
        ff = (PyFutureFeatures *)PyObject_Malloc(sizeof(PyFutureFeatures));
-       if (ff == NULL)
+       if (ff == NULL) {
+               PyErr_NoMemory();
                return NULL;
+       }
        ff->ff_features = 0;
        ff->ff_lineno = -1;
 
index c010b7a9b2c19ff16e5e95e8d1b30dd730c87cf1..439a24349dfbe45c29b0fb43b9e0026aae884506 100644 (file)
@@ -529,6 +529,8 @@ update_symbols(PyObject *symbols, PyObject *scope,
                i = PyInt_AS_LONG(w);
                flags |= (i << SCOPE_OFF);
                u = PyInt_FromLong(flags);
+               if (!u)
+                       return 0;
                if (PyDict_SetItem(symbols, name, u) < 0) {
                        Py_DECREF(u);
                        return 0;