aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends/mmaped_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstat/backends/mmaped_file.c')
-rw-r--r--src/libstat/backends/mmaped_file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c
index aa99b0902..0fb386f61 100644
--- a/src/libstat/backends/mmaped_file.c
+++ b/src/libstat/backends/mmaped_file.c
@@ -444,6 +444,10 @@ rspamd_mmaped_file_reindex (rspamd_mmaped_file_ctx * pool,
new = rspamd_mmaped_file_open (pool, filename, size, stcf);
if (fd == -1 || new == NULL) {
+ if (fd != -1) {
+ close (fd);
+ }
+
msg_err ("cannot open file: %s", strerror (errno));
g_free (backup);
return NULL;