Wireshark-bugs: [Wireshark-bugs] [Bug 12437] Crash (use-after-free) when sorting a column in the
Date: Tue, 14 Jun 2016 22:16:47 +0000

Comment # 5 on bug 12437 from
I tried to move the free to the destructor of the class. Since I'm not really
confident about that, I'm posting it here. The bug seems to have gone, but I'm
not sure I haven't broken any other part.

diff --git a/ui/qt/simple_statistics_dialog.cpp
b/ui/qt/simple_statistics_dialog.cpp
index 7e46086..2ec3ffb 100644
--- a/ui/qt/simple_statistics_dialog.cpp
+++ b/ui/qt/simple_statistics_dialog.cpp
@@ -285,7 +285,12 @@ void SimpleStatisticsDialog::fillTree()
     tapDraw(&stat_data);

     removeTapListeners();
-    free_stat_tables(stu_, NULL, NULL);
+}
+
+SimpleStatisticsDialog::~SimpleStatisticsDialog()
+{
+    if (stu_->tables)
+        free_stat_tables(stu_, NULL, NULL);
 }

 /*
diff --git a/ui/qt/simple_statistics_dialog.h
b/ui/qt/simple_statistics_dialog.h
index 47d1388..1c1afe4 100644
--- a/ui/qt/simple_statistics_dialog.h
+++ b/ui/qt/simple_statistics_dialog.h
@@ -49,6 +49,8 @@ private:
     static void tapReset(void *sd_ptr);
     static void tapDraw(void *sd_ptr);

+    ~SimpleStatisticsDialog();
+
 private slots:
     virtual void fillTree();


You are receiving this mail because:
  • You are watching all bug changes.