diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-07-14 16:47:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 16:47:17 (GMT) |
commit | 91f791400338673f025897c70da99301c85694c5 (patch) | |
tree | 0399c679e18cb00d8046dcdc195fe94f0e3c9c6e /Modules | |
parent | 29fc20cdc068b1d744371d3e5a0e87b1dc7b73e5 (diff) | |
download | cpython-91f791400338673f025897c70da99301c85694c5.zip cpython-91f791400338673f025897c70da99301c85694c5.tar.gz cpython-91f791400338673f025897c70da99301c85694c5.tar.bz2 |
GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup (GH-94298)
(cherry picked from commit 01ef1f95dab9c9930ce1a23634a3e5a8331bf3c7)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_pickle.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 23d26f6..b4b1dda 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -4773,7 +4773,9 @@ _pickle_Pickler___init___impl(PicklerObject *self, PyObject *file, { return -1; } - + if (self->dispatch_table != NULL) { + return 0; + } if (_PyObject_LookupAttr((PyObject *)self, &_Py_ID(dispatch_table), &self->dispatch_table) < 0) { return -1; |