aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-17 17:03:11 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-17 17:03:11 +0000
commit30e37db22654d400f2ac2f9d89e89678a7782131 (patch)
tree5643ce79fce530d92cd9501755113d9b44fbd4bc
parent1d2c51cad95d3a1d4874da7513c498fcc605996b (diff)
downloadrspamd-30e37db22654d400f2ac2f9d89e89678a7782131.tar.gz
rspamd-30e37db22654d400f2ac2f9d89e89678a7782131.zip
Allow to allocate shingles without pool.
-rw-r--r--src/libutil/shingles.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c
index 287e5875d..2307a318c 100644
--- a/src/libutil/shingles.c
+++ b/src/libutil/shingles.c
@@ -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];