From 5e257910391f13adde093fdb7e336e0ddf29f6fe Mon Sep 17 00:00:00 2001 From: Alexey Izbyshev Date: Wed, 22 Aug 2018 01:59:09 +0300 Subject: [PATCH] bpo-34456: pickle: Add missing NULL check to save_global() Reported by Svace static analyzer. --- Modules/_pickle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/_pickle.c b/Modules/_pickle.c index ea778c763520fc..517c99e1746b88 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)