8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:03:02 +01:00

Minor correction for Vlad's solution to CORE-4680

This commit is contained in:
Dmitry Yemanov 2019-12-19 10:13:41 +03:00
parent 010afc5760
commit a6c6d15daa

View File

@ -2358,6 +2358,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
@ -2405,12 +2407,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;
@ -2432,6 +2428,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);
}
}