]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131316: fix invalid `DECREF` in `_md5.md5.copy()` (#135291)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Mon, 9 Jun 2025 09:10:32 +0000 (11:10 +0200)
committerGitHub <noreply@github.com>
Mon, 9 Jun 2025 09:10:32 +0000 (09:10 +0000)
This amends commit 261633bd3f48607478f50d12d8025cd4bb36f6f4.

Modules/md5module.c

index 9b5ea2d6e02605a74c0d332988ede5d2b7c1c30e..08dbcd2cbce844b6ab73555d120760956ed7aa23 100644 (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;