]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Allocate larger config static pool
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 27 Jan 2018 15:22:01 +0000 (15:22 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 27 Jan 2018 15:22:01 +0000 (15:22 +0000)
src/libserver/cfg_utils.c
src/libutil/mem_pool.c

index e14495ded4a1719e33ace7839fc7392cb91bd574..d3e27755e23501d40be69e3c084bb4a8fb4e4c71 100644 (file)
@@ -117,7 +117,8 @@ rspamd_config_new (void)
        struct rspamd_config *cfg;
 
        cfg = g_malloc0 (sizeof (*cfg));
-       cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "cfg");
+       /* Allocate larger pool for cfg */
+       cfg->cfg_pool = rspamd_mempool_new (8 * 1024 * 1024, "cfg");
        cfg->dns_timeout = 1000;
        cfg->dns_retransmits = 5;
        /* After 20 errors do throttling for 10 seconds */
index f45bf885790549a3624146cbfa91feb3d5b83a65..4b4875699847694f94b4f2d0168a654171073987 100644 (file)
@@ -354,7 +354,13 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
                        sizeof (struct _pool_destructors), 32);
        rspamd_mempool_create_pool_type (new, RSPAMD_MEMPOOL_NORMAL);
        /* Set it upon first call of set variable */
-       new->elt_len = new->entry->cur_suggestion;
+
+       if (size == 0) {
+               new->elt_len = new->entry->cur_suggestion;
+       }
+       else {
+               new->elt_len = size;
+       }
 
        if (tag) {
                rspamd_strlcpy (new->tag.tagname, tag, sizeof (new->tag.tagname));