FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40645: Fix reference leak in the _hashopenssl extension by encukou · Pull Request #26072 · python/cpython · GitHub

/ cpython Public

bpo-40645: Fix reference leak in the _hashopenssl extension - #26072

Merged
miss-islington merged 1 commit into
python:mainfrom
encukou:hashlib-refleak
May 12, 2021
Merged

bpo-40645: Fix reference leak in the _hashopenssl extension#26072
miss-islington merged 1 commit into
python:mainfrom
encukou:hashlib-refleak

Conversation

encukou commented May 12, 2021
edited by miss-islington
Loading

Copy link
Copy Markdown
Member

The PyModule_AddObjectRef function doesn't steal a reference, so an extra Py_DECREF is needed.

https://bugs.python.org/issue40645

Automerge-Triggered-By: GH:tiran

The PyModule_AddObjectRef function doesn't steal a reference,
so an extra Py_DECREF is needed.

tiran commented May 12, 2021

Copy link
Copy Markdown
Member

Thank you!

erlend-aasland commented May 12, 2021
edited
Loading

Copy link
Copy Markdown
Contributor

There's also three leaks in the preceding for-loop:name_obj and func => fixed in 26079

Comment thread Modules/_hashopenssl.c
Comment on lines 2109 to +2112
if (PyModule_AddObjectRef(module, "_constructors", proxy) < 0) {
return -1;
}
Py_DECREF(proxy);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Decref in case PyModule_AddObjectRef fails, no?

Suggested change
if (PyModule_AddObjectRef(module, "_constructors", proxy) < 0) {
return -1;
}
Py_DECREF(proxy);
int rc = PyModule_AddObjectRef(module, "_constructors", proxy);
Py_DECREF(proxy);
if (rc < 0) {
return -1;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

FYI, fixed in #26079

Copy link
Copy Markdown
Contributor

@encukou: Status check is done, and it's a success ✅ .

miss-islington merged commit 3611db5 into python:main May 12, 2021

Copy link
Copy Markdown
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

Copy link
Copy Markdown
Contributor

Sorry @encukou, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 3611db53f5b854cb6d01ee5ebb5e11c87bcc2df5 3.10

Mariatta commented Jun 2, 2021

Copy link
Copy Markdown
Member

Does this still need backport to 3.10?

Copy link
Copy Markdown
Contributor

Does this still need backport to 3.10?

I believe so, yes.

cc @pablogsal.

Copy link
Copy Markdown
Member

Does this still need backport to 3.10?

I believe so, yes.

cc @pablogsal.

This indeed need to be backported

Copy link
Copy Markdown
Contributor

I can create a backport of this together with a backport of #26079, @pablogsal. Let me know if that's ok with you, @encukou.

encukou commented Jun 4, 2021

Copy link
Copy Markdown
Member Author

It is. Thank you!

encukou deleted the hashlib-refleak branch June 4, 2021 08:00

Copy link
Copy Markdown
Contributor

Oh, I already did this in #26082 :) Backport is done; no further actions needed.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

8 participants


Back | FazBrowse Home | New Git URL