Skip to content

Commit 3152bc3

Browse files
miss-islingtonAlexey Izbyshev
andauthored
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Reported by Svace static analyzer. (cherry picked from commit f8c06b0) Co-authored-by: Alexey Izbyshev <[email protected]>
1 parent 985dcd4 commit 3152bc3

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
@@ -3452,6 +3452,8 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
34523452
PickleState *st = _Pickle_GetGlobalState();
34533453
PyObject *reduce_value = Py_BuildValue("(O(OO))",
34543454
st->getattr, parent, lastname);
3455+
if (reduce_value == NULL)
3456+
goto error;
34553457
status = save_reduce(self, reduce_value, NULL);
34563458
Py_DECREF(reduce_value);
34573459
if (status < 0)

0 commit comments

Comments
 (0)