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>
This commit is contained in:
Peter Wu 2019-01-27 00:12:44 +01:00
parent e3a9cc6761
commit 50fb318026
1 changed files with 1 additions and 0 deletions

View File

@ -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);