aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2022-08-16 22:59:36 -0400
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-08-22 03:45:20 +0000
commit00bfdf46a70a4f1be42db9219f4a13e636c1f639 (patch)
treebf5632800cddae1e8da94fcdd8654bf6a0c0aadb
parent2617ff294fd7cd03b776130048cbc358ff7e6d0c (diff)
Qt: Fix export objects memory leak
The export object entries were never getting freed, creating a pretty serious memory leak. =1307558==ERROR: LeakSanitizer: detected memory leaks Direct leak of 2237664 byte(s) in 46618 object(s) allocated from: #0 0x55ac70d80457 in malloc (/home/johnthacker/wireshark-clang/run/wireshark+0x1a4a457) (BuildId: ad576854e9259fb05a7d0aacbff6e3e1f8e41157) #1 0x7fe8ff2f4278 in g_malloc (/lib64/libglib-2.0.so.0+0x5a278) (BuildId: 8a4c270219135729dff508e4bb3cc03099af40e8) #2 0x7fe910912ff4 in tap_push_tapped_queue /home/johnthacker/wireshark/epan/tap.c:366:15 #3 0x7fe910711548 in epan_dissect_run_with_taps /home/johnthacker/wireshark/epan/epan.c:640:2 #4 0x55ac7263288d in retap_packet /home/johnthacker/wireshark/file.c:2241:5 #5 0x55ac7263201c in process_specified_records /home/johnthacker/wireshark/file.c:2207:14 #6 0x55ac726315fc in cf_retap_packets /home/johnthacker/wireshark/file.c:2292:11 #7 0x55ac712aed41 in ExportObjectDialog::show() /home/johnthacker/wireshark/ui/qt/export_object_dialog.cpp:173:15 ... Indirect leak of 1700955 byte(s) in 139854 object(s) allocated from: #0 0x55ac70d80457 in malloc (/home/johnthacker/wireshark-clang/run/wireshark+0x1a4a457) (BuildId: ad576854e9259fb05a7d0aacbff6e3e1f8e41157) #1 0x7fe8ff2f4278 in g_malloc (/lib64/libglib-2.0.so.0+0x5a278) (BuildId: 8a4c270219135729dff508e4bb3cc03099af40e8) ... SUMMARY: AddressSanitizer: 3961187 byte(s) leaked in 186587 allocation(s).
-rw-r--r--ui/qt/models/export_objects_model.cpp7
-rw-r--r--ui/qt/models/export_objects_model.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/ui/qt/models/export_objects_model.cpp b/ui/qt/models/export_objects_model.cpp
index 5cf8196a2c..7ade2899b3 100644
--- a/ui/qt/models/export_objects_model.cpp
+++ b/ui/qt/models/export_objects_model.cpp
@@ -53,6 +53,13 @@ ExportObjectModel::ExportObjectModel(register_eo_t* eo, QObject *parent) :
export_object_list_.gui_data = (void*)&eo_gui_data_;
}
+ExportObjectModel::~ExportObjectModel()
+{
+ foreach (QVariant v, objects_) {
+ eo_free_entry(VariantPointer<export_object_entry_t>::asPtr(v));
+ }
+}
+
QVariant ExportObjectModel::data(const QModelIndex &index, int role) const
{
if ((!index.isValid()) || ((role != Qt::DisplayRole) && (role != Qt::UserRole))) {
diff --git a/ui/qt/models/export_objects_model.h b/ui/qt/models/export_objects_model.h
index fd2f518fd8..1aff4345c4 100644
--- a/ui/qt/models/export_objects_model.h
+++ b/ui/qt/models/export_objects_model.h
@@ -31,6 +31,7 @@ class ExportObjectModel : public QAbstractTableModel
public:
ExportObjectModel(register_eo_t* eo, QObject *parent);
+ virtual ~ExportObjectModel();
enum ExportObjectColumn {
colPacket = 0,