gh-131316: fix invalid DECREF in _md5.md5.copy() (#135291)

This amends commit 261633bd3f48607478f50d12d8025cd4bb36f6f4.
This commit is contained in:
Bénédikt Tran 2025-06-09 11:10:32 +02:00 committed by GitHub
parent 8441b263af
commit c19e36cc4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,7 +120,7 @@ MD5Type_copy_impl(MD5object *self, PyTypeObject *cls)
newobj->hash_state = Hacl_Hash_MD5_copy(self->hash_state);
LEAVE_HASHLIB(self);
if (newobj->hash_state == NULL) {
Py_DECREF(self);
Py_DECREF(newobj);
return PyErr_NoMemory();
}
return (PyObject *)newobj;