Fix various memleaks
[metze/wireshark/wip.git] / ui / qt / wireshark_application.cpp
index 50fe3fff0b8bcfd46c687782ddca76e6a397c0c9..3d5f983d7f39f623436a2bdf53fbc37d48fa00e2 100644 (file)
@@ -193,7 +193,7 @@ void WiresharkApplication::refreshRecentFiles(void) {
             continue;
         }
 
-        rf_status = new RecentFileStatus(ri->filename);
+        rf_status = new RecentFileStatus(ri->filename, this);
 
         connect(rf_status, SIGNAL(statusFound(QString, qint64, bool)),
                 this, SLOT(itemStatusFinished(QString, qint64, bool)), Qt::QueuedConnection);
@@ -342,11 +342,11 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
 
     (void) readConfigurationFiles (&gdp_path, &dp_path);
 
-    recent_read_profile_static(&rf_path, &rf_open_errno);
-    if (rf_path != NULL && rf_open_errno != 0) {
+    if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
         simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
             "Could not open common recent file\n\"%s\": %s.",
             rf_path, g_strerror(rf_open_errno));
+        g_free(rf_path);
     }
     if (recent.gui_fileopen_remembered_dir &&
         test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
@@ -484,7 +484,6 @@ WiresharkApplication::WiresharkApplication(int &argc,  char **argv) :
     setApplicationName("Wireshark");
 
     Q_INIT_RESOURCE(about);
-    Q_INIT_RESOURCE(display_filter);
     Q_INIT_RESOURCE(i18n);
     Q_INIT_RESOURCE(layout);
     Q_INIT_RESOURCE(status);
@@ -982,7 +981,7 @@ QList<recent_item_status *> WiresharkApplication::recentItems() const {
     return recent_items_;
 }
 
-void WiresharkApplication::addRecentItem(const QString &filename, qint64 size, bool accessible) {
+void WiresharkApplication::addRecentItem(const QString filename, qint64 size, bool accessible) {
     recent_item_status *ri = new(recent_item_status);
 
     ri->filename = filename;