Skip to content

Commit ba0d1b7

Browse files
authored
[3.13] gh-145301: Fix double-free in hashlib initialization (GH-145321) (GH-145532)
(cherry picked from commit 6acaf65)
1 parent 4e33246 commit ba0d1b7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:mod:`hashlib`: fix a crash when the initialization of the underlying C
2+
extension module fails.

Modules/_hashopenssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ py_hashentry_table_new(void) {
239239

240240
if (h->py_alias != NULL) {
241241
if (_Py_hashtable_set(ht, (const void*)entry->py_alias, (void*)entry) < 0) {
242-
PyMem_Free(entry);
242+
/* entry is already in ht, will be freed by _Py_hashtable_destroy() */
243243
goto error;
244244
}
245245
entry->refcnt++;

0 commit comments

Comments
 (0)