aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-07 15:33:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-07 15:33:27 +0000
commit3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8 (patch)
tree3266ecf308de4c32efa76be5b9250d073e87740c /src/libutil
parent091586c865c94b4f3d961d24f26e43f845a8c646 (diff)
downloadrspamd-3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8.tar.gz
rspamd-3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8.zip
[Minor] Add guards when free an expresssion
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/expression.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libutil/expression.c b/src/libutil/expression.c
index a7cc1af80..6ee6ccb67 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -354,9 +354,16 @@ rspamd_expression_destroy (struct rspamd_expression *expr)
}
}
- g_array_free (expr->expressions, TRUE);
- g_ptr_array_free (expr->expression_stack, TRUE);
- g_node_destroy (expr->ast);
+ if (expr->expressions) {
+ g_array_free (expr->expressions, TRUE);
+ }
+ if (expr->expression_stack) {
+ g_ptr_array_free (expr->expression_stack, TRUE);
+ }
+ if (expr->ast) {
+ g_node_destroy (expr->ast);
+ }
+
g_slice_free1 (sizeof (*expr), expr);
}
}