-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-40645: Fix reference leak in the _hashopenssl extension #26072
Conversation
The PyModule_AddObjectRef function doesn't steal a reference, so an extra Py_DECREF is needed.
Thank you! |
There's also three leaks in the preceding for-loop: |
if (PyModule_AddObjectRef(module, "_constructors", proxy) < 0) { | ||
return -1; | ||
} | ||
Py_DECREF(proxy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decref in case PyModule_AddObjectRef
fails, no?
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; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, fixed in #26079
@encukou: Status check is done, and it's a success ✅ . |
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Sorry @encukou, I had trouble checking out the |
Does this still need backport to 3.10? |
I believe so, yes. cc @pablogsal. |
This indeed need to be backported |
I can create a backport of this together with a backport of #26079, @pablogsal. Let me know if that's ok with you, @encukou. |
It is. Thank you! |
Oh, I already did this in #26082 :) Backport is done; no further actions needed. |
The
PyModule_AddObjectRef
function doesn't steal a reference, so an extraPy_DECREF
is needed.https://bugs.python.org/issue40645
Automerge-Triggered-By: GH:tiran