From: Vsevolod Stakhov Date: Tue, 7 Feb 2017 15:33:27 +0000 (+0000) Subject: [Minor] Add guards when free an expresssion X-Git-Tag: 1.5.0~159 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3e7227fb5bc04ba4b03b65eb27d1b892cc271ca8;p=rspamd.git [Minor] Add guards when free an expresssion --- 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); } }