mirror of https://github.com/python/cpython
closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in builtin_sum_impl() (GH-8872)
Reported by Svace static analyzer.
This commit is contained in:
parent
f6247aac08
commit
2b824b2538
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue