aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/data.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/c/data.h b/c/data.h
index 7114440..4fbf3e4 100644
--- a/c/data.h
+++ b/c/data.h
@@ -117,12 +117,16 @@ struct FileView
cbMap.QuadPart = c*sizeof(T);
hm = CreateFileMapping(hf, nullptr, PAGE_READWRITE,
cbMap.HighPart, cbMap.LowPart, nullptr);
- if (!hm)
+ if (!hm) {
+ CloseHandle(hf);
throw Win32Error();
+ }
view = reinterpret_cast<T*>(MapViewOfFile(hm, FILE_MAP_ALL_ACCESS, 0, 0, 0));
- if (!view)
+ if (!view) {
+ CloseHandle(hm);
throw Win32Error();
+ }
}
~FileView()