diff options
author | Mikael Kanstrup <mikael.kanstrup@gmail.com> | 2017-08-25 10:24:36 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-08-28 14:42:44 +0000 |
commit | 81c48eacccbeb3466e607c0f708f38869da70491 (patch) | |
tree | 8a9b396034fa134726910f8c8c66e29df32a6659 /ui | |
parent | e26926432d163cd835b7f8f1ab51e084c04050b7 (diff) |
Fix leak when removing interfaces from manage interfaces dialog
When removing interfaces from the manage interfaces dialog the
interface elements where not freed properly causing leaks.
Free the interface element when removed from the array.
Ping-Bug: 13864
Change-Id: I6beb222a5475278cfc6cb454a7c8b2c86f636f38
Reviewed-on: https://code.wireshark.org/review/23203
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/manage_interfaces_dialog.cpp | 1 | ||||
-rw-r--r-- | ui/qt/models/interface_tree_cache_model.cpp | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp index 5d48bdbe09..55948bf167 100644 --- a/ui/qt/manage_interfaces_dialog.cpp +++ b/ui/qt/manage_interfaces_dialog.cpp @@ -499,6 +499,7 @@ void ManageInterfacesDialog::on_delRemote_clicked() interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i); if (item->text(col_r_host_dev_).compare(device->remote_opts.remote_host_opts.remote_host)) continue; + capture_opts_free_interface_t(device); global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i); } delete item; diff --git a/ui/qt/models/interface_tree_cache_model.cpp b/ui/qt/models/interface_tree_cache_model.cpp index 3c1a6aa7d8..fea9020066 100644 --- a/ui/qt/models/interface_tree_cache_model.cpp +++ b/ui/qt/models/interface_tree_cache_model.cpp @@ -595,7 +595,9 @@ void InterfaceTreeCacheModel::deleteDevice(const QModelIndex &index) } else { - g_array_remove_index(global_capture_opts.all_ifaces, row); + interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, row); + capture_opts_free_interface_t(device); + global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, row); emit endRemoveRows(); wsApp->emitAppSignal(WiresharkApplication::LocalInterfacesChanged); } |