From e468284ada70e7b87ebc136ca4be5677cece6415 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 11 Jun 2020 13:16:29 -0700 Subject: [PATCH] adapter: Fix leaking filter pattern When a discovery client has set a pattern as filter the code allocates the string so it needs to be freed with the filter otherwise it leads to the following leak: 10 bytes in 2 blocks are definitely lost in loss record 19 of 265 at 0x483980B: malloc (vg_replace_malloc.c:309) by 0x4D9FF7E: strdup (in /usr/lib64/libc-2.30.so) by 0x1FC8E7: parse_pattern (adapter.c:2454) by 0x1FF37B: parse_discovery_filter_entry (adapter.c:2480) by 0x1FF37B: parse_discovery_filter_dict (adapter.c:2538) by 0x2020AF: set_discovery_filter (adapter.c:2589) by 0x24AD63: process_message.isra.0 (object.c:259) by 0x24B40F: generic_message (object.c:1079) by 0x4A670B7: ??? (in /usr/lib64/libdbus-1.so.3.19.11) by 0x4A57763: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.11) by 0x2459CF: message_dispatch (mainloop.c:72) by 0x4963E8A: ??? (in /usr/lib64/libglib-2.0.so.0.6200.6) by 0x496756F: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6200.6) --- src/adapter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/adapter.c b/src/adapter.c index c9ce6b571..dd1cb36ab 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1468,6 +1468,7 @@ static void free_discovery_filter(struct discovery_filter *discovery_filter) return; g_slist_free_full(discovery_filter->uuids, free); + free(discovery_filter->pattern); g_free(discovery_filter); } -- 2.47.3