summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-08-14 04:52:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-08-14 04:52:56 (GMT)
commit223546d55cddf0e1c52e114201747ab154216fd4 (patch)
tree50a0b6d4edddf111fe17de2640956470d316c548
parent9168d069bf41fc561f6d53a04bb97d2133b37775 (diff)
downloadcpython-223546d55cddf0e1c52e114201747ab154216fd4.zip
cpython-223546d55cddf0e1c52e114201747ab154216fd4.tar.gz
cpython-223546d55cddf0e1c52e114201747ab154216fd4.tar.bz2
add missing NULL checks to get_coding_spec (closes #24854)
-rw-r--r--Parser/tokenizer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index d0e4a0e..109c0ee 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -235,7 +235,10 @@ get_coding_spec(const char *s, Py_ssize_t size)
if (begin < t) {
char* r = new_string(begin, t - begin);
- char* q = get_normal_name(r);
+ char* q;
+ if (!r)
+ return NULL;
+ q = get_normal_name(r);
if (r != q) {
PyMem_FREE(r);
r = new_string(q, strlen(q));