diff options
author | Alexey Izbyshev <izbyshev@ispras.ru> | 2018-08-24 04:27:52 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2018-08-24 04:27:52 (GMT) |
commit | 2b824b2538c4a5f9f520c5de8a1eae5a0c181a94 (patch) | |
tree | e90901a2d03d0924875239187f50771992abf492 /Python/bltinmodule.c | |
parent | f6247aac08c1a79d0479145a405718bb76dba434 (diff) | |
download | cpython-2b824b2538c4a5f9f520c5de8a1eae5a0c181a94.zip cpython-2b824b2538c4a5f9f520c5de8a1eae5a0c181a94.tar.gz cpython-2b824b2538c4a5f9f520c5de8a1eae5a0c181a94.tar.bz2 |
closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in builtin_sum_impl() (GH-8872)
Reported by Svace static analyzer.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 4b12048..8aa1ba0 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2401,6 +2401,11 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start) } } result = PyFloat_FromDouble(f_result); + if (result == NULL) { + Py_DECREF(item); + Py_DECREF(iter); + return NULL; + } temp = PyNumber_Add(result, item); Py_DECREF(result); Py_DECREF(item); |