mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
safe error reporting in case of mmap failure
This commit is contained in:
@@ -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