]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-130547: Fix race between dict_dealloc and split_keys_entry_added (gh-130778)
authorDonghee Na <donghee.na@python.org>
Tue, 4 Mar 2025 13:50:33 +0000 (22:50 +0900)
committerGitHub <noreply@github.com>
Tue, 4 Mar 2025 13:50:33 +0000 (22:50 +0900)
Objects/dictobject.c

index e30d626439e7f8903aea94e502d94cf628d9f4b6..8a30c4082e92364dcd7e848fbb0bcbe6d83764aa 100644 (file)
@@ -3254,7 +3254,7 @@ dict_dealloc(PyObject *self)
     Py_TRASHCAN_BEGIN(mp, dict_dealloc)
     if (values != NULL) {
         if (values->embedded == 0) {
-            for (i = 0, n = mp->ma_keys->dk_nentries; i < n; i++) {
+            for (i = 0, n = values->capacity; i < n; i++) {
                 Py_XDECREF(values->values[i]);
             }
             free_values(values, false);