From f7e7c513a1b79cc0d59015676c8d8bf1191015cf Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Thu, 19 Dec 2019 10:13:41 +0300 Subject: [PATCH] Minor correction for Vlad's solution to CORE-4680 --- src/common/isc_sync.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/isc_sync.cpp b/src/common/isc_sync.cpp index 8c328be0f3..9400dbcdd9 100644 --- a/src/common/isc_sync.cpp +++ b/src/common/isc_sync.cpp @@ -2353,6 +2353,8 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject else length = header_address[0]; + fb_assert(length); + // Create the real file mapping object. TEXT mapping_name[64]; // enough for int32 as text @@ -2400,12 +2402,6 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject sh_mem_header = (MemoryHeader*) address; sh_mem_length_mapped = length; - - if (!sh_mem_length_mapped) - { - (Arg::Gds(isc_random) << "sh_mem_length_mapped is 0").raise(); - } - sh_mem_handle = file_handle; sh_mem_object = file_obj; sh_mem_interest = event_handle; @@ -2426,6 +2422,12 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject SetEvent(event_handle); if (err) { + UnmapViewOfFile(address); + CloseHandle(file_obj); + UnmapViewOfFile(header_address); + CloseHandle(header_obj); + CloseHandle(event_handle); + CloseHandle(file_handle); system_call_failed::raise("FlushViewOfFile", err); } }