From e0380b0dd47ce72028019fba6d63558d145557db Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 22 Sep 2024 15:28:40 +0200 Subject: [PATCH] Don't attempt to close a handle twice This is pretty harmless, but still, when running e.g. gh14537.phpt with a debugger attached we get a `C0000028` ("an invalid handle was specified") error at https://github.com/php/php-src/blob/27b3131422b53f9b37bba5235bc20610687fad2e/TSRM/tsrm_win32.c#L74 --- TSRM/tsrm_win32.c | 1 + 1 file changed, 1 insertion(+) diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 52fbc95bbd457..4b8445542fce8 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -708,6 +708,7 @@ TSRM_API int shmget(key_t key, size_t size, int flags) if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz)) { if (NULL != shm->segment) { CloseHandle(shm->segment); + shm->segment = INVALID_HANDLE_VALUE; } UnmapViewOfFile(shm->descriptor); shm->descriptor = NULL;