]> source.dussan.org Git - rspamd.git/commitdiff
Allow to allocate shingles without pool.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 17 Dec 2014 17:03:11 +0000 (17:03 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 17 Dec 2014 17:03:11 +0000 (17:03 +0000)
src/libutil/shingles.c

index 287e5875de2b6d2c59422a20d85342de01fdd69c..2307a318c662996895b2a81a48fdf7d5253c182c 100644 (file)
@@ -54,7 +54,13 @@ rspamd_shingles_generate (GArray *input,
        gint i, j, beg = 0;
        gsize shalen;
 
-       res = rspamd_mempool_alloc (pool, sizeof (*res));
+       if (pool != NULL) {
+               res = rspamd_mempool_alloc (pool, sizeof (*res));
+       }
+       else {
+               res = g_malloc (sizeof (*res));
+       }
+
        cksum = g_checksum_new (G_CHECKSUM_SHA256);
        cur_key = key;
        out_key = (guchar *)&keys[0];