summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorAlexey Izbyshev <izbyshev@ispras.ru>2018-08-22 04:51:25 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-08-22 04:51:25 (GMT)
commitf8c06b028036e50596e75d4c9f6b27ba05133efe (patch)
treea90230adc6372d1fc358b96a4ef612e002ff7b26 /Modules/_pickle.c
parentef8861c112ed1dac9351958c121bc24ca4ecdb08 (diff)
downloadcpython-f8c06b028036e50596e75d4c9f6b27ba05133efe.zip
cpython-f8c06b028036e50596e75d4c9f6b27ba05133efe.tar.gz
cpython-f8c06b028036e50596e75d4c9f6b27ba05133efe.tar.bz2
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Reported by Svace static analyzer.
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index ea778c7..517c99e 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3454,6 +3454,8 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
PickleState *st = _Pickle_GetGlobalState();
PyObject *reduce_value = Py_BuildValue("(O(OO))",
st->getattr, parent, lastname);
+ if (reduce_value == NULL)
+ goto error;
status = save_reduce(self, reduce_value, NULL);
Py_DECREF(reduce_value);
if (status < 0)