From: Benjamin Peterson Date: Mon, 27 Jul 2015 14:47:21 +0000 (-0700) Subject: check return value of PyString_FromStringAndSize for NULL (closes #24734) X-Git-Tag: v2.7.11rc1~222 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0287f2f7cbeee90491b24f24da871c981074ac00;p=thirdparty%2FPython%2Fcpython.git check return value of PyString_FromStringAndSize for NULL (closes #24734) Patch by Pankaj Sharma. --- diff --git a/Python/compile.c b/Python/compile.c index e871d380fc48..290075763a69 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1979,9 +1979,12 @@ compiler_import(struct compiler *c, stmt_ty s) identifier tmp = alias->name; const char *base = PyString_AS_STRING(alias->name); char *dot = strchr(base, '.'); - if (dot) + if (dot) { tmp = PyString_FromStringAndSize(base, dot - base); + if (tmp == NULL) + return 0; + } r = compiler_nameop(c, tmp, Store); if (dot) { Py_DECREF(tmp);