From 72dabec06849a0b6db6bcf009a63a7e3c08b7563 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 29 Jun 2016 13:34:45 +0100 Subject: [PATCH] [Fix] Fix memory leak in unsigned maps reading --- src/libutil/map.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libutil/map.c b/src/libutil/map.c index 171719b5e..7731cfea9 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -380,15 +380,9 @@ http_map_finish (struct rspamd_http_connection *conn, else { /* Unsinged version - just open file */ cbd->shmem_data = rspamd_http_message_shmem_ref (msg); - in = rspamd_shmem_xmap (cbd->shmem_data->shm_name, PROT_READ, &inlen); cbd->data_len = msg->body_buf.len; - if (in == NULL) { - msg_err_map ("cannot read tempfile %s: %s", - cbd->shmem_data->shm_name, - strerror (errno)); - goto err; - } + goto read_data; } } else if (cbd->stage == map_load_pubkey) { @@ -470,6 +464,7 @@ http_map_finish (struct rspamd_http_connection *conn, munmap (in, dlen); } +read_data: g_assert (cbd->shmem_data != NULL); in = rspamd_shmem_xmap (cbd->shmem_data->shm_name, PROT_READ, &dlen); -- 2.39.5