Skip to content

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

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

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix reference leak in the :mod:`_hashopenssl` extension. Patch by Pablo
Galindo.
5 changes: 3 additions & 2 deletions Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ EVP_new_impl(PyObject *module, PyObject *name_obj, PyObject *data_obj,
/*[clinic end generated code: output=ddd5053f92dffe90 input=c24554d0337be1b0]*/
{
Py_buffer view = { 0 };
PyObject *ret_obj;
PyObject *ret_obj = NULL;
char *name;
const EVP_MD *digest = NULL;

Expand All @@ -879,13 +879,14 @@ EVP_new_impl(PyObject *module, PyObject *name_obj, PyObject *data_obj,

digest = py_digest_by_name(name);
if (digest == NULL) {
return NULL;
goto exit;
}

ret_obj = EVPnew(module, digest,
(unsigned char*)view.buf, view.len,
usedforsecurity);

exit:
if (data_obj)
PyBuffer_Release(&view);
return ret_obj;
Expand Down