]> granicus.if.org Git - python/commitdiff
bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)
authorAlexey Izbyshev <izbyshev@ispras.ru>
Wed, 22 Aug 2018 04:55:16 +0000 (07:55 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 22 Aug 2018 04:55:16 +0000 (07:55 +0300)
Reported by Svace static analyzer.

Python/ast.c

index 3b4cd162fcce2f80d719aaa7b5f5377b19820b9a..a91c075dae66848aa5db363cd3540920a0429b86 100644 (file)
@@ -3252,6 +3252,8 @@ alias_for_import_name(struct compiling *c, const node *n, int store)
             break;
         case STAR:
             str = PyUnicode_InternFromString("*");
+            if (!str)
+                return NULL;
             if (PyArena_AddPyObject(c->c_arena, str) < 0) {
                 Py_DECREF(str);
                 return NULL;