[Python-checkins] cpython (2.7): check return value of PyString_FromStringAndSize for NULL (closes #24734)
benjamin.peterson
python-checkins at python.org
Mon Jul 27 16:47:36 CEST 2015
https://hg.python.org/cpython/rev/68cd7a64fbb0
changeset: 97088:68cd7a64fbb0
branch: 2.7
parent: 97079:5919531c0b03
user: Benjamin Peterson <benjamin at python.org>
date: Mon Jul 27 07:47:21 2015 -0700
summary:
check return value of PyString_FromStringAndSize for NULL (closes #24734)
Patch by Pankaj Sharma.
files:
Python/compile.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Python/compile.c b/Python/compile.c
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1979,9 +1979,12 @@
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);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list