File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,8 @@ bool CN3BaseFileAccess::LoadFromFile()
109109
110110 try
111111 {
112- return LoadSupportedVersions (file);
112+ if (LoadSupportedVersions (file))
113+ return true ;
113114 }
114115 catch (const std::exception& ex)
115116 {
@@ -122,6 +123,9 @@ bool CN3BaseFileAccess::LoadFromFile()
122123#endif
123124 }
124125
126+ // File failed to load. To avoid it being in an unexpected inconsistent state,
127+ // we should release it.
128+ Release ();
125129 return false ;
126130}
127131
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ char* SharedMemoryBlock::Open(const std::string& name)
7474 catch (const interprocess_exception& ex)
7575 {
7676 if (ex.get_error_code () != not_found_error)
77+ {
7778 spdlog::error (" SharedMemoryBlock::Open: failed to open existing shared memory block. "
7879 " name='{}' ex={}" ,
7980 name, ex.what ());
81+ }
8082 }
8183
8284 return nullptr ;
You can’t perform that action at this time.
0 commit comments