diff options
author | Ahmad Fatoum <ahmad.fatoum@siemens.com> | 2017-08-22 11:00:28 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-08-22 12:18:12 +0000 |
commit | be69761c78d0c285f88ea6b2da0399fcecf9d782 (patch) | |
tree | 3eb6fd63ca9f8ceafbb997b8ac70242b0e283e61 /capture_opts.c | |
parent | a34445c1cf340a5e617464aec4042df447327de5 (diff) |
Fix requesting hardware timestamps without -k
The interface_options struct passed to dumpcap is populated
differently when running Wireshark with and without -k.
Previously, only with -k was there a valid pointer in
interface_opts.timestamp_type
Fixes: aca55a2 ("Add hardware timestamping support")
Signed-off-by: Ahmad Fatoum <ahmad.fatoum@siemens.com>
Change-Id: Ic7ecc5a1190c28197d6a7271f1b353f74d43ca61
Reviewed-on: https://code.wireshark.org/review/23160
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'capture_opts.c')
-rw-r--r-- | capture_opts.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/capture_opts.c b/capture_opts.c index a5470904c2..29bb484b20 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -810,9 +810,11 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_ interface_opts = g_array_index(capture_opts->ifaces, interface_options, capture_opts->ifaces->len - 1); capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, capture_opts->ifaces->len - 1); + g_free(interface_opts.timestamp_type); interface_opts.timestamp_type = g_strdup(optarg_str_p); g_array_append_val(capture_opts->ifaces, interface_opts); } else { + g_free(capture_opts->default_options.timestamp_type); capture_opts->default_options.timestamp_type = g_strdup(optarg_str_p); } break; @@ -1161,6 +1163,7 @@ capture_opts_del_iface(capture_options *capture_opts, guint if_index) if (interface_opts.console_display_name != NULL) g_free(interface_opts.console_display_name); g_free(interface_opts.cfilter); + g_free(interface_opts.timestamp_type); #ifdef HAVE_EXTCAP g_free(interface_opts.extcap); g_free(interface_opts.extcap_fifo); @@ -1209,6 +1212,7 @@ collect_ifaces(capture_options *capture_opts) interface_opts.console_display_name = g_strdup(device.name); interface_opts.linktype = device.active_dlt; interface_opts.cfilter = g_strdup(device.cfilter); + interface_opts.timestamp_type = g_strdup(device.timestamp_type); interface_opts.snaplen = device.snaplen; interface_opts.has_snaplen = device.has_snaplen; interface_opts.promisc_mode = device.pmode; @@ -1277,6 +1281,7 @@ capture_opts_free_interface_t(interface_t *device) g_free(device->friendly_name); g_free(device->addresses); g_free(device->cfilter); + g_free(device->timestamp_type); g_list_foreach(device->links, capture_opts_free_interface_t_links, NULL); g_list_free(device->links); |