◐ Shell
clean mode source ↗

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

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

tiran

@tiran

@erlend-aasland

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

erlend-aasland

Comment on lines 2109 to +2112

if (PyModule_AddObjectRef(module, "_constructors", proxy) < 0) {
return -1;
}
Py_DECREF(proxy);

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;
}

Choose a reason for hiding this comment

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

@miss-islington

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

@miss-islington

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

@miss-islington

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

Does this still need backport to 3.10?

@erlend-aasland

Does this still need backport to 3.10?

I believe so, yes.

cc @pablogsal.

@pablogsal

Does this still need backport to 3.10?

I believe so, yes.

cc @pablogsal.

This indeed need to be backported

@erlend-aasland

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

@erlend-aasland

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