]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131591: Do not free page caches that weren't allocated (#143205)
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Sat, 27 Dec 2025 13:38:11 +0000 (13:38 +0000)
committerGitHub <noreply@github.com>
Sat, 27 Dec 2025 13:38:11 +0000 (13:38 +0000)
Python/remote_debug.h

index d9c5c480fe9a861fb89f008c494a1cd76c9c6cb1..dba6da3bad4197785d6a4dab10f16f806ce71088 100644 (file)
@@ -154,7 +154,9 @@ static void
 _Py_RemoteDebug_FreePageCache(proc_handle_t *handle)
 {
     for (int i = 0; i < MAX_PAGES; i++) {
-        PyMem_RawFree(handle->pages[i].data);
+        if (handle->pages[i].data) {
+            PyMem_RawFree(handle->pages[i].data);
+        }
         handle->pages[i].data = NULL;
         handle->pages[i].valid = 0;
     }