From 1a5e9eb0d746468340e29f291ea5488ff0946c97 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 16 Jun 2016 14:54:19 +0100 Subject: [PATCH] [Fix] Fix descriptors leak on shmem detaching --- src/libutil/http.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libutil/http.c b/src/libutil/http.c index 7196c92212..42d91b5cb8 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1524,6 +1524,12 @@ rspamd_http_detach_shared (struct rspamd_http_message *msg) { rspamd_fstring_t *cpy_str; + if (msg->body_buf.c.shared.shm_fd != -1) { + close (msg->body_buf.c.shared.shm_fd); + } + + REF_RELEASE (msg->body_buf.c.shared.name); + cpy_str = rspamd_fstring_new_init (msg->body_buf.begin, msg->body_buf.len); rspamd_http_message_set_body_from_fstring_steal (msg, cpy_str); } -- 2.47.3