mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-11-05 11:45:27 -07:00
safe error reporting in case of mmap failure
This commit is contained in:
1 parent
27f0ff14a3
commit
45ee985fda
1 file changed
+1
@@ -327,6 +327,7 @@ PgfDB::PgfDB(const char* filepath, int flags, int mode) {
|
||||
ms = (malloc_state*)
|
||||
mmap(NULL, file_size, PROT_READ | PROT_WRITE, mflags, fd, 0);
|
||||
if (ms == MAP_FAILED) {
|
||||
ms = NULL; // mark that ms is not created.
|
||||
::free((void *) this->filepath);
|
||||
int code = errno;
|
||||
close(fd);
|
||||
|
||||
Reference in new issue
Block a user