commit 0c5035f: [Minor] Some more fixes
Vsevolod Stakhov
vsevolod at rspamd.com
Sun May 1 12:07:05 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-05-01 12:56:01 +0100
URL: https://github.com/rspamd/rspamd/commit/0c5035fdbde4ee2277d1efbd111be2f88a5f16c7
[Minor] Some more fixes
---
src/libutil/cxx/locked_file.cxx | 4 +++-
src/libutil/cxx/locked_file.hxx | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/libutil/cxx/locked_file.cxx b/src/libutil/cxx/locked_file.cxx
index b6d0d6215..ca5600c5f 100644
--- a/src/libutil/cxx/locked_file.cxx
+++ b/src/libutil/cxx/locked_file.cxx
@@ -148,7 +148,9 @@ auto raii_mmaped_locked_file::mmap_shared(const char *fname, int open_flags,
raii_mmaped_locked_file::~raii_mmaped_locked_file()
{
- munmap(map, file.get_stat().st_size);
+ if (map != nullptr) {
+ munmap(map, file.get_stat().st_size);
+ }
}
raii_mmaped_locked_file::raii_mmaped_locked_file(raii_mmaped_locked_file &&other) noexcept
diff --git a/src/libutil/cxx/locked_file.hxx b/src/libutil/cxx/locked_file.hxx
index d136ebe72..6ac4ffd2c 100644
--- a/src/libutil/cxx/locked_file.hxx
+++ b/src/libutil/cxx/locked_file.hxx
@@ -59,7 +59,7 @@ struct raii_locked_file final {
raii_locked_file() = delete;
raii_locked_file(const raii_locked_file &other) = delete;
private:
- int fd;
+ int fd = -1;
bool temp;
std::string fname;
struct stat st;
@@ -94,7 +94,7 @@ private:
/* Is intended to be used with map_shared */
explicit raii_mmaped_locked_file(raii_locked_file &&_file, void *_map);
raii_locked_file file;
- void *map{};
+ void *map = nullptr;
};
/**
More information about the Commits
mailing list