From 50fb31802645003a55e1ecee7d03c4152ca92bc1 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 27 Jan 2019 00:12:44 +0100 Subject: tshark: fix minor memleak of the interface description Capturing with "tshark -i lo" results in capture_opts->descr being set to "Loopback" via: #3 0x55c5f575720c in fill_in_interface_opts_from_ifinfo capture_opts.c:547:33 #4 0x55c5f5750dc5 in capture_opts_add_iface_opt capture_opts.c:695:9 #5 0x55c5f574b6bd in capture_opts_add_opt capture_opts.c:843:18 #6 0x55c5f5785efc in main tshark.c:1087:21 but tshark overwrites it, presumably to offer textual descriptions like "Standard input" for "-i -". Fix this memory leak, reported by ASAN for three tests from case_tshark_capture that capture from Loopback. Change-Id: I4f393c4440bde7a621271cca3066bef3d57e250a Reviewed-on: https://code.wireshark.org/review/31756 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- tshark.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tshark.c b/tshark.c index 260d9cda8a..b3d86f49a2 100644 --- a/tshark.c +++ b/tshark.c @@ -2440,6 +2440,7 @@ capture(void) interface_options *interface_opts; interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, i); + g_free(interface_opts->descr); interface_opts->descr = get_interface_descriptive_name(interface_opts->name); } str = get_iface_list_string(&global_capture_opts, IFLIST_QUOTE_IF_DESCRIPTION); -- cgit v1.2.3