aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-01-27 00:12:44 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-01-27 09:43:55 +0000
commit50fb31802645003a55e1ecee7d03c4152ca92bc1 (patch)
tree04abcba5dd18bc84a4e1e41fde6a9e33640ee663
parente3a9cc6761c7e3d3401eb6e8d250e5cd89a1df50 (diff)
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 <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--tshark.c1
1 files changed, 1 insertions, 0 deletions
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);