diff --git a/lib/filterx/expr-compound.c b/lib/filterx/expr-compound.c index 0956ec36b..9a0bc144a 100644 --- a/lib/filterx/expr-compound.c +++ b/lib/filterx/expr-compound.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2024 Attila Szakacs + * Copyright (c) 2024 Axoflow + * Copyright (c) 2024 Attila Szakacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -146,6 +147,7 @@ filterx_compound_expr_add(FilterXExpr *s, FilterXExpr *expr) g_ptr_array_add(self->exprs, expr); } +/* Takes reference of expr_list */ void filterx_compound_expr_add_list(FilterXExpr *s, GList *expr_list) { @@ -153,6 +155,7 @@ filterx_compound_expr_add_list(FilterXExpr *s, GList *expr_list) { filterx_compound_expr_add(s, elem->data); } + g_list_free(expr_list); } FilterXExpr * diff --git a/lib/filterx/expr-generator.c b/lib/filterx/expr-generator.c index 882c38611..92d6e2625 100644 --- a/lib/filterx/expr-generator.c +++ b/lib/filterx/expr-generator.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2024 Attila Szakacs + * Copyright (c) 2024 Axoflow + * Copyright (c) 2024 Attila Szakacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -96,14 +97,15 @@ _create_container_free(FilterXExpr *s) filterx_expr_free_method(s); } +/* Takes reference of g and fillable_parent */ FilterXExpr * filterx_generator_create_container_new(FilterXExpr *g, FilterXExpr *fillable_parent) { FilterXExprGeneratorCreateContainer *self = g_new0(FilterXExprGeneratorCreateContainer, 1); filterx_expr_init_instance(&self->super); - self->generator = (FilterXExprGenerator *) filterx_expr_ref(g); - self->fillable_parent = filterx_expr_ref(fillable_parent); + self->generator = (FilterXExprGenerator *) g; + self->fillable_parent = fillable_parent; self->super.eval = _create_container_eval; self->super.free_fn = _create_container_free; diff --git a/lib/filterx/filterx-grammar.ym b/lib/filterx/filterx-grammar.ym index cdf9a9cf5..97782c707 100644 --- a/lib/filterx/filterx-grammar.ym +++ b/lib/filterx/filterx-grammar.ym @@ -1,4 +1,6 @@ /* + * Copyright (c) 2024 Axoflow + * Copyright (c) 2024 Attila Szakacs * Copyright (c) 2023 Balazs Scheidler * * This library is free software; you can redistribute it and/or @@ -220,7 +222,9 @@ generator_assignment filterx_generator_set_fillable($5, filterx_getattr_new(filterx_expr_ref($1), filterx_config_frozen_string(configuration, $3))); $$ = filterx_compound_expr_new_va(TRUE, - filterx_setattr_new($1, filterx_config_frozen_string(configuration, $3), filterx_generator_create_container_new($5, $1)), + filterx_setattr_new(filterx_expr_ref($1), + filterx_config_frozen_string(configuration, $3), + filterx_generator_create_container_new(filterx_expr_ref($5), $1)), $5, NULL ); @@ -231,7 +235,9 @@ generator_assignment filterx_generator_set_fillable($6, filterx_get_subscript_new(filterx_expr_ref($1), filterx_expr_ref($3))); $$ = filterx_compound_expr_new_va(TRUE, - filterx_set_subscript_new($1, $3, filterx_generator_create_container_new($6, $1)), + filterx_set_subscript_new(filterx_expr_ref($1), + $3, + filterx_generator_create_container_new(filterx_expr_ref($6), $1)), $6, NULL ); @@ -242,7 +248,9 @@ generator_assignment filterx_generator_set_fillable($5, filterx_get_subscript_new(filterx_expr_ref($1), minus_one)); $$ = filterx_compound_expr_new_va(TRUE, - filterx_set_subscript_new($1, NULL, filterx_generator_create_container_new($5, $1)), + filterx_set_subscript_new(filterx_expr_ref($1), + NULL, + filterx_generator_create_container_new(filterx_expr_ref($5), $1)), $5, NULL ); @@ -255,7 +263,7 @@ generator_assignment filterx_generator_set_fillable($3, filterx_expr_ref($1)); $$ = filterx_compound_expr_new_va(TRUE, - filterx_assign_new($1, filterx_generator_create_container_new($3, json_func)), + filterx_assign_new($1, filterx_generator_create_container_new(filterx_expr_ref($3), json_func)), $3, NULL ); diff --git a/lib/filterx/object-message-value.c b/lib/filterx/object-message-value.c index 7a6651337..2d1536220 100644 --- a/lib/filterx/object-message-value.c +++ b/lib/filterx/object-message-value.c @@ -1,4 +1,6 @@ /* + * Copyright (c) 2024 Axoflow + * Copyright (c) 2024 Attila Szakacs * Copyright (c) 2023 Balazs Scheidler * * This library is free software; you can redistribute it and/or @@ -224,7 +226,7 @@ _unmarshal_repr(const gchar *repr, gssize repr_len, LogMessageValueType t) return NULL; } -/* NOTE: calling map_to_json() on a FilterXMessageBase is less than ideal as +/* NOTE: calling map_to_json() on a FilterXMessageValue is less than ideal as * we would unmarshal the value and then drop the result. The expectation * is that the caller would explicitly unmarshall first, cache the result * and call map_to_json on the unmarshalled object. @@ -232,7 +234,7 @@ _unmarshal_repr(const gchar *repr, gssize repr_len, LogMessageValueType t) static gboolean _map_to_json(FilterXObject *s, struct json_object **jso, FilterXObject **assoc_object) { - FilterXObject *unmarshalled_object = filterx_object_unmarshal(filterx_object_ref(s)); + FilterXObject *unmarshalled_object = filterx_object_unmarshal(s); if (unmarshalled_object) {