]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix memory corruprtion and leak
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 18 Jan 2017 23:36:42 +0000 (23:36 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 18 Jan 2017 23:36:42 +0000 (23:36 +0000)
src/libserver/rspamd_control.c
src/libutil/expression.c
src/plugins/fuzzy_check.c
src/rspamd.c

index 592e3dbc123962ca7b2d74e3fb9e551547723364..c78f501f777e9e9f92e53f099691ef850300a025 100644 (file)
@@ -774,6 +774,7 @@ rspamd_srv_handler (gint fd, short what, gpointer ud)
                        rdata->rep.id = cmd.id;
                        rdata->rep.type = cmd.type;
                        rdata->fd = -1;
+
                        if (msg.msg_controllen >= CMSG_LEN (sizeof (int))) {
                                rfd = *(int *) CMSG_DATA(CMSG_FIRSTHDR (&msg));
                        }
index adc926e533ee40b7b312c07efaa5e67bdd46f3d9..a7cc1af8045bc7a6e69c9c189b2ae6d5ddf89c84 100644 (file)
@@ -567,6 +567,7 @@ rspamd_parse_expression (const gchar *line, gsize len,
        enum rspamd_expression_op op, op_stack;
        const gchar *p, *c, *end;
        GPtrArray *operand_stack;
+       GNode *tmp;
 
        enum {
                PARSE_ATOM = 0,
@@ -859,6 +860,10 @@ rspamd_parse_expression (const gchar *line, gsize len,
        return TRUE;
 
 err:
+       while ((tmp = rspamd_expr_stack_elt_pop (operand_stack)) != NULL) {
+               g_node_destroy (tmp);
+       }
+
        g_ptr_array_free (operand_stack, TRUE);
        rspamd_expression_destroy (e);
 
index 040219e2a8000685a4992b31fbe40d4677f05908..804db15e62ddbd68a69a0b15e2b0bc74b4dfc5bd 100644 (file)
@@ -419,12 +419,6 @@ fuzzy_parse_rule (struct rspamd_config *cfg, const ucl_object_t *obj,
                }
        }
 
-       if (rule->mime_types != NULL) {
-               rspamd_mempool_add_destructor (fuzzy_module_ctx->fuzzy_pool,
-                       (rspamd_mempool_destruct_t)rspamd_ptr_array_free_hard,
-                       rule->mime_types);
-       }
-
        if ((value = ucl_object_lookup (obj, "headers")) != NULL) {
                it = NULL;
                while ((cur = ucl_object_iterate (value, &it, value->type == UCL_ARRAY))
index 6a9c4f321d6ba1c8eac97343898362550d2eb648..877ac00a5f38cdab2cf2ffe2a415f90df20ebd3d 100644 (file)
@@ -160,6 +160,7 @@ read_cmd_line (gint *argc, gchar ***argv, struct rspamd_config *cfg)
 
        if (!g_option_context_parse (context, argc, argv, &error)) {
                fprintf (stderr, "option parsing failed: %s\n", error->message);
+               g_option_context_free (context);
                exit (1);
        }
 
@@ -192,6 +193,7 @@ read_cmd_line (gint *argc, gchar ***argv, struct rspamd_config *cfg)
        }
 
        cfg->pid_file = rspamd_pidfile;
+       g_option_context_free (context);
 }
 
 /* Detect privilleged mode */