From 30e37db22654d400f2ac2f9d89e89678a7782131 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 17 Dec 2014 17:03:11 +0000 Subject: [PATCH] Allow to allocate shingles without pool. --- src/libutil/shingles.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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]; -- 2.39.5