]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Close fd
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Oct 2021 14:54:45 +0000 (15:54 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Oct 2021 14:54:45 +0000 (15:54 +0100)
src/libstat/backends/cdb_backend.cxx

index 5b5b42cdf4e51bfc29fa61fd54e292d405588fbc..7715e9b6bdb8861d4843c4b6747cef2aec597f87 100644 (file)
@@ -307,11 +307,15 @@ open_cdb(struct rspamd_statfile *st) -> tl::expected<ro_backend, std::string>
                cdbp = cdb_shared_storage::new_cdb();
 
                if (cdb_init(cdbp.get(), fd) == -1) {
+                       close(fd);
+
                        return tl::make_unexpected(fmt::format("cannot init cdb in {}: {}",
                                        path, strerror(errno)));
                }
 
                cdbp = cdb_shared_storage.push_cdb(path, cdbp);
+
+               close(fd);
        }
        else {
                cdbp = cached_cdb_maybe.value();