Skip to content

Commit f8c06b0

Browse files
Alexey Izbyshevserhiy-storchaka
authored andcommitted
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Reported by Svace static analyzer.
1 parent ef8861c commit f8c06b0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_pickle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,6 +3454,8 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
34543454
PickleState *st = _Pickle_GetGlobalState();
34553455
PyObject *reduce_value = Py_BuildValue("(O(OO))",
34563456
st->getattr, parent, lastname);
3457+
if (reduce_value == NULL)
3458+
goto error;
34573459
status = save_reduce(self, reduce_value, NULL);
34583460
Py_DECREF(reduce_value);
34593461
if (status < 0)

0 commit comments

Comments
 (0)