Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-126991: Fix reference leak in _pickle.c's load_build #126990

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

Legoclones
Copy link
Contributor

@Legoclones Legoclones commented Nov 19, 2024

Reference leak in load_build of _pickle.c

If PyObject_SetItem() fails in the load_build() function of _pickle.c, no DECREF for the dict variable

Issue - #126991

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable
@ZeroIntensity ZeroIntensity changed the title Fix reference leak in _pickle.c's load_build gh-126991: Fix reference leak in _pickle.c's load_build Nov 19, 2024
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny change, but this does technically need a NEWS entry.

Also, in the future, use the gh-<issue number>: prefix for PRs so things get linked properly. I've done it for you this time though :)

@ZeroIntensity ZeroIntensity added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Nov 19, 2024
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The test for this is non-trivial, so I wrote it myself.

@serhiy-storchaka serhiy-storchaka merged commit 29cbcbd into python:main Nov 19, 2024
49 checks passed
@miss-islington-app
Copy link

Thanks @Legoclones for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 19, 2024
…ythonGH-126990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 19, 2024
…ythonGH-126990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 19, 2024

GH-127018 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Nov 19, 2024
@bedevere-app
Copy link

bedevere-app bot commented Nov 19, 2024

GH-127019 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Nov 19, 2024
serhiy-storchaka pushed a commit that referenced this pull request Nov 19, 2024
…GH-126990) (GH-127019)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
serhiy-storchaka pushed a commit that referenced this pull request Nov 19, 2024
…GH-126990) (GH-127018)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants