diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-25 03:24:57 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-25 03:24:57 +0200 |
commit | 158e54f071a3b2b41e6105fc3064ce8297fe532a (patch) | |
tree | de2664b6088849aa866dfca8fe84f83f0bbc8101 | |
parent | 69fc595053d2075d6a7d99d94912156851a0221d (diff) | |
download | EpisodeBrowser-158e54f071a3b2b41e6105fc3064ce8297fe532a.tar.gz |
FileView: Close handles on error in constructor.
-rw-r--r-- | c/data.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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() |