diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-07 15:33:27 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-07 15:33:27 +0000 |
commit | 3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8 (patch) | |
tree | 3266ecf308de4c32efa76be5b9250d073e87740c /src/libutil | |
parent | 091586c865c94b4f3d961d24f26e43f845a8c646 (diff) | |
download | rspamd-3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8.tar.gz rspamd-3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8.zip |
[Minor] Add guards when free an expresssion
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/expression.c | 13 |
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); } } |