]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 22 Aug 2018 05:54:55 +0000 (01:54 -0400)
committerGitHub <noreply@github.com>
Wed, 22 Aug 2018 05:54:55 +0000 (01:54 -0400)
Reported by Svace static analyzer.
(cherry picked from commit 28853a249b1d0c890b7e9ca345290bb8c1756446)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Python/ast.c

index ede7f4fd990ca73e2cd24e88a39ede3a2450e03c..51175cdb55e6a20f03ee6121efcca2e580267bd2 100644 (file)
@@ -3267,6 +3267,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;