diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-03-29 13:17:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 13:17:40 (GMT) |
commit | 70cdf1812cf479c6b1cd7435a6fc0679ec1fb0da (patch) | |
tree | a2ad510654f58688a2afabaa8c6762e19e941237 /Modules | |
parent | 9b999479c0022edfc9835a8a1f06e046f3881048 (diff) | |
download | cpython-70cdf1812cf479c6b1cd7435a6fc0679ec1fb0da.zip cpython-70cdf1812cf479c6b1cd7435a6fc0679ec1fb0da.tar.gz cpython-70cdf1812cf479c6b1cd7435a6fc0679ec1fb0da.tar.bz2 |
bpo-40645: Fix reference leak in the _hashopenssl extension (GH-25063)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_hashopenssl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 6c83b9e..ef927ab 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -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; @@ -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; |