]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix memory leak in unsigned maps reading
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 29 Jun 2016 12:34:45 +0000 (13:34 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 29 Jun 2016 12:34:45 +0000 (13:34 +0100)
src/libutil/map.c

index 171719b5edc64f4051a2430b88cd882d6449260d..7731cfea9a504efed5437d6d9547a5b0f64788d8 100644 (file)
@@ -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);