From: Vsevolod Stakhov Date: Wed, 29 Jun 2016 12:34:45 +0000 (+0100) Subject: [Fix] Fix memory leak in unsigned maps reading X-Git-Tag: 1.3.0~221 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=72dabec06849a0b6db6bcf009a63a7e3c08b7563;p=rspamd.git [Fix] Fix memory leak in unsigned maps reading --- 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);