summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAlexey Izbyshev <izbyshev@ispras.ru>2018-08-24 04:27:52 (GMT)
committerBenjamin Peterson <benjamin@python.org>2018-08-24 04:27:52 (GMT)
commit2b824b2538c4a5f9f520c5de8a1eae5a0c181a94 (patch)
treee90901a2d03d0924875239187f50771992abf492 /Python
parentf6247aac08c1a79d0479145a405718bb76dba434 (diff)
downloadcpython-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')
-rw-r--r--Python/bltinmodule.c5
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);