From d0b01f8396b95f70b0b13075bc851dff144183a5 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Sat, 27 Dec 2025 01:43:51 +0000 Subject: [PATCH] gh-131591: Do not free page caches that weren't allocated --- Python/remote_debug.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index d9c5c480fe9a86..dba6da3bad4197 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -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; }