trimmer: free GMatchInfo object in set_bound_from_str
When a call to compile_and_match succeeds, it returns an allocated
GMatchInfo object in `*match_info`, which is never freed, causing a
memory leak:
==
3711000== 508 (72 direct, 436 indirect) bytes in 1 blocks are definitely lost in loss record 33 of 42
==
3711000== at 0x483AB65: calloc (vg_replace_malloc.c:762)
==
3711000== by 0x49CB7C1: g_malloc0 (in /usr/lib/libglib-2.0.so.0.6200.4)
==
3711000== by 0x49BCEAA: ??? (in /usr/lib/libglib-2.0.so.0.6200.4)
==
3711000== by 0x49BD310: g_regex_match_full (in /usr/lib/libglib-2.0.so.0.6200.4)
==
3711000== by 0x49BDEEA: g_regex_match (in /usr/lib/libglib-2.0.so.0.6200.4)
==
3711000== by 0x510CF25: compile_and_match (trimmer.c:187)
==
3711000== by 0x510D55D: set_bound_from_str (trimmer.c:378)
==
3711000== by 0x510D90A: set_bound_from_param (trimmer.c:463)
==
3711000== by 0x510DEBE: init_trimmer_comp_from_params (trimmer.c:568)
==
3711000== by 0x510E090: trimmer_init (trimmer.c:643)
==
3711000== by 0x4886457: add_component_with_init_method_data (graph.c:971)
==
3711000== by 0x4886C28: bt_graph_add_filter_component_with_initialize_method_data (graph.c:1075)
Fix that by calling g_match_info_free at the end of the function.
Reported-by: Valgrind Memcheck
Change-Id: Iee42f63d45f5761e1191dcc6d3f6d47e75a4123c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2727
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>