aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-14 18:50:56 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-14 18:50:56 +0100
commit7fcce899c3ab7c2c10d55d523b50cea7355883f5 (patch)
tree0df1d1d72459d93d0c0ab10423b72289d7128922 /src/libutil
parent356f35cb0707181811bbb43fb56bc6d1bfdde866 (diff)
downloadrspamd-7fcce899c3ab7c2c10d55d523b50cea7355883f5.tar.gz
rspamd-7fcce899c3ab7c2c10d55d523b50cea7355883f5.zip
[Fix] Fix crash on empty maps
Issue: #695 Reported by: @moisseev
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/map.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 0c8e6b925..c5123631f 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -1128,13 +1128,17 @@ static void
rspamd_map_backend_dtor (struct rspamd_map_backend *bk)
{
if (bk->protocol == MAP_PROTO_FILE) {
- g_free (bk->data.fd->filename);
- g_slice_free1 (sizeof (*bk->data.fd), bk->data.fd);
+ if (bk->data.fd) {
+ g_free (bk->data.fd->filename);
+ g_slice_free1 (sizeof (*bk->data.fd), bk->data.fd);
+ }
}
else {
- g_free (bk->data.hd->host);
- g_free (bk->data.hd->path);
- g_slice_free1 (sizeof (*bk->data.hd), bk->data.hd);
+ if (bk->data.hd) {
+ g_free (bk->data.hd->host);
+ g_free (bk->data.hd->path);
+ g_slice_free1 (sizeof (*bk->data.hd), bk->data.hd);
+ }
}
g_slice_free1 (sizeof (*bk), bk);