]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add guards when free an expresssion
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Feb 2017 15:33:27 +0000 (15:33 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Feb 2017 15:33:27 +0000 (15:33 +0000)
src/libutil/expression.c

index a7cc1af8045bc7a6e69c9c189b2ae6d5ddf89c84..6ee6ccb67168fbef02496e7be27092327a6ecdf6 100644 (file)
@@ -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);
        }
 }