diff options
-rw-r--r-- | TSRM/tsrm_win32.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 7bafd2b7b1..285ab61e48 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -620,6 +620,11 @@ TSRM_API int shmget(int key, int size, int flags) } shm = shm_get(key, NULL); + if (!shm) { + UnmapViewOfFile(shm_handle); + UnmapViewOfFile(shm_handle); + return -1; + } shm->segment = shm_handle; shm->info = info_handle; shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); |