]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (#121136)
authorJustin Applegate <70449145+Legoclones@users.noreply.github.com>
Fri, 28 Jun 2024 21:43:45 +0000 (15:43 -0600)
committerGitHub <noreply@github.com>
Fri, 28 Jun 2024 21:43:45 +0000 (14:43 -0700)
PyObject_GetAttr returns a new reference, but this reference is never decremented using Py_DECREF, so Py_DECREF calls to this referece are added

Modules/_pickle.c

index 21be88a79d8705ffd9117257c0091e7dcf1d9751..4a2191db0cf984a05b4e500ab3cd74bb837f1dd6 100644 (file)
@@ -6524,11 +6524,13 @@ load_additems(PickleState *state, UnpicklerObject *self)
             if (result == NULL) {
                 Pdata_clear(self->stack, i + 1);
                 Py_SET_SIZE(self->stack, mark);
+                Py_DECREF(add_func);
                 return -1;
             }
             Py_DECREF(result);
         }
         Py_SET_SIZE(self->stack, mark);
+        Py_DECREF(add_func);
     }
 
     return 0;