Qt: fix memleak from cf_get_display_name
authorPeter Wu <peter@lekensteyn.nl>
Sat, 26 May 2018 11:32:06 +0000 (13:32 +0200)
committerAnders Broman <a.broman58@gmail.com>
Wed, 30 May 2018 08:18:47 +0000 (08:18 +0000)
Free the memory as documented.

Change-Id: I8a8842160be676bb08f5b93e795b9ed8edef2ede
Reviewed-on: https://code.wireshark.org/review/27829
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
ui/qt/sctp_assoc_analyse_dialog.cpp
ui/qt/sctp_chunk_statistics_dialog.cpp
ui/qt/sctp_graph_arwnd_dialog.cpp
ui/qt/sctp_graph_byte_dialog.cpp
ui/qt/sctp_graph_dialog.cpp
ui/qt/tcp_stream_dialog.cpp

index 107733be0e58b2e7018b106fb73f0e88d6edc13f..b965c94241fdc4fd28398433313eaeec25923eb0 100644 (file)
@@ -39,7 +39,7 @@ SCTPAssocAnalyseDialog::SCTPAssocAnalyseDialog(QWidget *parent, sctp_assoc_info_
             | Qt::WindowMinimizeButtonHint
             | Qt::WindowCloseButtonHint;
     this->setWindowFlags(flags);
-    this->setWindowTitle(QString(tr("SCTP Analyse Association: %1 Port1 %2 Port2 %3")).arg(cf_get_display_name(cap_file_)).arg(selected_assoc->port1).arg(selected_assoc->port2));
+    this->setWindowTitle(QString(tr("SCTP Analyse Association: %1 Port1 %2 Port2 %3")).arg(gchar_free_to_qstring(cf_get_display_name(cap_file_))).arg(selected_assoc->port1).arg(selected_assoc->port2));
     fillTabs();
 }
 
index f7baf6debb16f8cd7f9ed934ac7e92477ec6d47f..08496f6a2982462be896d80ffc24fe56d5143575 100644 (file)
@@ -13,8 +13,7 @@
 
 #include <wsutil/strtoi.h>
 
-#include <string>
-
+#include <ui/qt/utils/qt_ui_utils.h>
 
 SCTPChunkStatisticsDialog::SCTPChunkStatisticsDialog(QWidget *parent, sctp_assoc_info_t *assoc, capture_file *cf) :
     QDialog(parent),
@@ -37,7 +36,7 @@ SCTPChunkStatisticsDialog::SCTPChunkStatisticsDialog(QWidget *parent, sctp_assoc
 
     ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
 
-    this->setWindowTitle(QString(tr("SCTP Chunk Statistics: %1 Port1 %2 Port2 %3")).arg(cf_get_display_name(cap_file_)).arg(selected_assoc->port1).arg(selected_assoc->port2));
+    this->setWindowTitle(QString(tr("SCTP Chunk Statistics: %1 Port1 %2 Port2 %3")).arg(gchar_free_to_qstring(cf_get_display_name(cap_file_))).arg(selected_assoc->port1).arg(selected_assoc->port2));
  //   connect(ui->tableWidget->verticalHeader(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(on_sectionMoved(int, int, int)));
 
     ctx_menu_.addAction(ui->actionHideChunkType);
index 7e313cb233a579bbbe774df4e121614caf645c11..1347a543fc3917dcab6e0beb1c527a1ecb9171fe 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "ui/tap-sctp-analysis.h"
 
+#include <ui/qt/utils/qt_ui_utils.h>
 #include <ui/qt/widgets/qcustomplot.h>
 #include "sctp_graph_dialog.h"
 
@@ -39,7 +40,7 @@ SCTPGraphArwndDialog::SCTPGraphArwndDialog(QWidget *parent, sctp_assoc_info_t *a
             | Qt::WindowMaximizeButtonHint
             | Qt::WindowCloseButtonHint;
     this->setWindowFlags(flags);
-    this->setWindowTitle(QString(tr("SCTP Data and Adv. Rec. Window over Time: %1 Port1 %2 Port2 %3")).arg(cf_get_display_name(cap_file_)).arg(selected_assoc->port1).arg(selected_assoc->port2));
+    this->setWindowTitle(QString(tr("SCTP Data and Adv. Rec. Window over Time: %1 Port1 %2 Port2 %3")).arg(gchar_free_to_qstring(cf_get_display_name(cap_file_))).arg(selected_assoc->port1).arg(selected_assoc->port2));
     if ((direction == 1 && selected_assoc->n_array_tsn1 == 0) || (direction == 2 && selected_assoc->n_array_tsn2 == 0)) {
         QMessageBox msgBox;
         msgBox.setText(tr("No Data Chunks sent"));
index 97168382726b671c886ddf74d50c551823cd045e..3d3753e208b60a1bd9cc83a23a1861ef77b9c764 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "ui/tap-sctp-analysis.h"
 
+#include <ui/qt/utils/qt_ui_utils.h>
 #include <ui/qt/widgets/qcustomplot.h>
 #include "sctp_graph_dialog.h"
 #include "sctp_assoc_analyse_dialog.h"
@@ -38,7 +39,7 @@ SCTPGraphByteDialog::SCTPGraphByteDialog(QWidget *parent, sctp_assoc_info_t *ass
             | Qt::WindowMaximizeButtonHint
             | Qt::WindowCloseButtonHint;
     this->setWindowFlags(flags);
-    this->setWindowTitle(QString(tr("SCTP Data and Adv. Rec. Window over Time: %1 Port1 %2 Port2 %3")).arg(cf_get_display_name(cap_file_)).arg(selected_assoc->port1).arg(selected_assoc->port2));
+    this->setWindowTitle(QString(tr("SCTP Data and Adv. Rec. Window over Time: %1 Port1 %2 Port2 %3")).arg(gchar_free_to_qstring(cf_get_display_name(cap_file_))).arg(selected_assoc->port1).arg(selected_assoc->port2));
     if ((direction == 1 && selected_assoc->n_array_tsn1 == 0) || (direction == 2 && selected_assoc->n_array_tsn2 == 0)) {
         QMessageBox msgBox;
         msgBox.setText(tr("No Data Chunks sent"));
index f3546e53309832064336bf08a52d22b17a6a5627..18c3ac196fef89c49e7337bc9625644e514d314b 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QMessageBox>
 
+#include <ui/qt/utils/qt_ui_utils.h>
 #include <ui/qt/widgets/qcustomplot.h>
 #include "ui/qt/widgets/wireshark_file_dialog.h"
 #include "wireshark_application.h"
@@ -45,7 +46,7 @@ SCTPGraphDialog::SCTPGraphDialog(QWidget *parent, sctp_assoc_info_t *assoc, capt
             | Qt::WindowMaximizeButtonHint
             | Qt::WindowCloseButtonHint;
     this->setWindowFlags(flags);
-    this->setWindowTitle(QString(tr("SCTP TSNs and SACKs over Time: %1 Port1 %2 Port2 %3")).arg(cf_get_display_name(cap_file_)).arg(selected_assoc->port1).arg(selected_assoc->port2));
+    this->setWindowTitle(QString(tr("SCTP TSNs and SACKs over Time: %1 Port1 %2 Port2 %3")).arg(gchar_free_to_qstring(cf_get_display_name(cap_file_))).arg(selected_assoc->port1).arg(selected_assoc->port2));
     if ((direction == 1 && selected_assoc->n_array_tsn1 == 0) || (direction == 2 && selected_assoc->n_array_tsn2 == 0)) {
         QMessageBox msgBox;
         msgBox.setText(tr("No Data Chunks sent"));
index 2350fd124c8ed8d5ec49314d3c85310848efeb92..c537d2844d06bce6e15073d645c9ae8db027a009 100644 (file)
@@ -216,7 +216,7 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
     ui->showBytesOutCheckBox->blockSignals(false);
 
     QCustomPlot *sp = ui->streamPlot;
-    QCPPlotTitle *file_title = new QCPPlotTitle(sp, cf_get_display_name(cap_file_));
+    QCPPlotTitle *file_title = new QCPPlotTitle(sp, gchar_free_to_qstring(cf_get_display_name(cap_file_)));
     file_title->setFont(sp->xAxis->labelFont());
     title_ = new QCPPlotTitle(sp);
     sp->plotLayout()->insertRow(0);