summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/capture.c1
-rw-r--r--ui/gtk/main.c12
-rw-r--r--ui/iface_lists.c20
-rw-r--r--ui/qt/main_welcome.cpp5
-rw-r--r--ui/qt/main_welcome.h1
-rw-r--r--ui/qt/module_preferences_scroll_area.cpp2
-rw-r--r--ui/qt/wireshark_application.cpp4
-rw-r--r--ui/recent.c21
-rw-r--r--ui/recent.h9
9 files changed, 44 insertions, 31 deletions
diff --git a/ui/capture.c b/ui/capture.c
index 8113c67166..f553fa8975 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -764,6 +764,7 @@ capture_stat_stop(if_stat_cache_t *sc) {
g_free(sc_item->name);
g_free(sc_item);
}
+ g_list_free(sc->cache_list);
g_free(sc);
}
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 721f942e53..5870daef0b 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2441,11 +2441,11 @@ DIAG_ON(cast-qual)
/* Only the static part of it will be read, as we don't have the gui now to fill the */
/* recent lists which is done in the dynamic part. */
/* We have to do this already here, so command line parameters can overwrite these values. */
- 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 recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
if (recent.gui_fileopen_remembered_dir &&
@@ -3097,11 +3097,11 @@ DIAG_ON(cast-qual)
create_main_window(pl_size, tv_size, bv_size, prefs_p);
/* Read the dynamic part of the recent file, as we have the gui now ready for it. */
- recent_read_dynamic(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_dynamic(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
color_filters_enable(recent.packet_list_colorize);
@@ -3880,11 +3880,11 @@ void change_configuration_profile (const gchar *profile_name)
(void) read_configuration_files (&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) {
diff --git a/ui/iface_lists.c b/ui/iface_lists.c
index 8c29dd357e..ba07c3eb7e 100644
--- a/ui/iface_lists.c
+++ b/ui/iface_lists.c
@@ -63,7 +63,7 @@ void
scan_local_interfaces(void (*update_cb)(void))
{
GList *if_entry, *lt_entry, *if_list;
- if_info_t *if_info, *temp;
+ if_info_t *if_info, temp;
char *if_string;
gchar *descr;
if_capabilities_t *caps=NULL;
@@ -130,14 +130,14 @@ scan_local_interfaces(void (*update_cb)(void))
}
device.hidden = FALSE;
device.locked = FALSE;
- temp = (if_info_t *)g_malloc0(sizeof(if_info_t));
- temp->name = g_strdup(if_info->name);
- temp->friendly_name = g_strdup(if_info->friendly_name);
- temp->vendor_description = g_strdup(if_info->vendor_description);
- temp->loopback = if_info->loopback;
- temp->type = if_info->type;
+ memset(&temp, 0, sizeof(temp));
+ temp.name = g_strdup(if_info->name);
+ temp.friendly_name = g_strdup(if_info->friendly_name);
+ temp.vendor_description = g_strdup(if_info->vendor_description);
+ temp.loopback = if_info->loopback;
+ temp.type = if_info->type;
#ifdef HAVE_EXTCAP
- temp->extcap = g_strdup(if_info->extcap);
+ temp.extcap = g_strdup(if_info->extcap);
#endif
/* Is this interface hidden and, if so, should we include it anyway? */
@@ -217,7 +217,7 @@ scan_local_interfaces(void (*update_cb)(void))
temp_addr = NULL;
}
if (temp_addr) {
- temp->addrs = g_slist_append(temp->addrs, temp_addr);
+ temp.addrs = g_slist_append(temp.addrs, temp_addr);
}
}
#ifdef HAVE_PCAP_REMOTE
@@ -274,7 +274,7 @@ scan_local_interfaces(void (*update_cb)(void))
device.addresses = g_strdup(ip_str->str);
device.no_addresses = ips;
device.local = TRUE;
- device.if_info = *temp;
+ device.if_info = temp;
device.last_packets = 0;
if (!capture_dev_user_pmode_find(if_info->name, &device.pmode)) {
device.pmode = global_capture_opts.default_options.promisc_mode;
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index 27f6aaeb7b..492a4dfbb4 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -176,6 +176,11 @@ MainWelcome::MainWelcome(QWidget *parent) :
splash_overlay_ = new SplashOverlay(this);
}
+MainWelcome::~MainWelcome()
+{
+ delete welcome_ui_;
+}
+
InterfaceTree *MainWelcome::getInterfaceTree()
{
return welcome_ui_->interfaceTree;
diff --git a/ui/qt/main_welcome.h b/ui/qt/main_welcome.h
index 6e70aaef19..97d66c0f53 100644
--- a/ui/qt/main_welcome.h
+++ b/ui/qt/main_welcome.h
@@ -40,6 +40,7 @@ class MainWelcome : public QFrame
Q_OBJECT
public:
explicit MainWelcome(QWidget *parent = 0);
+ virtual ~MainWelcome();
InterfaceTree *getInterfaceTree();
protected:
diff --git a/ui/qt/module_preferences_scroll_area.cpp b/ui/qt/module_preferences_scroll_area.cpp
index 4fabd71044..3144133d4b 100644
--- a/ui/qt/module_preferences_scroll_area.cpp
+++ b/ui/qt/module_preferences_scroll_area.cpp
@@ -114,7 +114,7 @@ pref_show(pref_t *pref, gpointer layout_ptr)
QLabel *label = new QLabel(pref->title);
label->setToolTip(tooltip);
vb->addWidget(label);
- QButtonGroup *enum_bg = new QButtonGroup();
+ QButtonGroup *enum_bg = new QButtonGroup(vb);
for (ev = pref->info.enum_info.enumvals; ev && ev->description; ev++) {
QRadioButton *enum_rb = new QRadioButton(title_to_shortcut(ev->description));
enum_rb->setToolTip(tooltip);
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 3dc8297143..3d5f983d7f 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -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) {
diff --git a/ui/recent.c b/ui/recent.c
index 2633ac92cf..82666ffff2 100644
--- a/ui/recent.c
+++ b/ui/recent.c
@@ -1208,7 +1208,7 @@ recent_set_arg(char *prefarg)
/* opens the user's recent common file and read the first part */
-void
+gboolean
recent_read_static(char **rf_path_return, int *rf_errno_return)
{
char *rf_path;
@@ -1241,8 +1241,6 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL);
fclose(rf);
- g_free(rf_path);
- rf_path = NULL;
} else {
/* We failed to open it. If we failed for some reason other than
"it doesn't exist", return the errno and the pathname, so our
@@ -1250,14 +1248,17 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
if (errno != ENOENT) {
*rf_errno_return = errno;
*rf_path_return = rf_path;
+ return FALSE;
}
}
+ g_free(rf_path);
+ return TRUE;
}
/* opens the user's recent file and read the first part */
-void
+gboolean
recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
{
char *rf_path, *rf_common_path;
@@ -1322,8 +1323,6 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
fclose(rf);
}
g_free(rf_common_path);
- g_free(rf_path);
- rf_path = NULL;
} else {
/* We failed to open it. If we failed for some reason other than
"it doesn't exist", return the errno and the pathname, so our
@@ -1331,12 +1330,15 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
if (errno != ENOENT) {
*rf_errno_return = errno;
*rf_path_return = rf_path;
+ return FALSE;
}
}
+ g_free(rf_path);
+ return TRUE;
}
/* opens the user's recent file and read it out */
-void
+gboolean
recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
{
char *rf_path;
@@ -1361,8 +1363,6 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
dfilter_combo_add_empty();
#endif
fclose(rf);
- g_free(rf_path);
- rf_path = NULL;
} else {
/* We failed to open it. If we failed for some reason other than
"it doesn't exist", return the errno and the pathname, so our
@@ -1370,8 +1370,11 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
if (errno != ENOENT) {
*rf_errno_return = errno;
*rf_path_return = rf_path;
+ return FALSE;
}
}
+ g_free(rf_path);
+ return TRUE;
}
gint
diff --git a/ui/recent.h b/ui/recent.h
index ef5f357f07..766f5be473 100644
--- a/ui/recent.h
+++ b/ui/recent.h
@@ -123,22 +123,25 @@ extern gboolean write_profile_recent(void);
*
* @param rf_path_return path to recent file if function failed
* @param rf_errno_return if failed
+ * @return TRUE if succeeded, FALSE if failed (check parameters for reason).
*/
-extern void recent_read_static(char **rf_path_return, int *rf_errno_return);
+extern gboolean recent_read_static(char **rf_path_return, int *rf_errno_return);
/** Read profile recent settings file (static part).
*
* @param rf_path_return path to recent file if function failed
* @param rf_errno_return if failed
+ * @return TRUE if succeeded, FALSE if failed (check parameters for reason).
*/
-extern void recent_read_profile_static(char **rf_path_return, int *rf_errno_return);
+extern gboolean recent_read_profile_static(char **rf_path_return, int *rf_errno_return);
/** Read recent settings file (dynamic part).
*
* @param rf_path_return path to recent file if function failed
* @param rf_errno_return if failed
+ * @return TRUE if succeeded, FALSE if failed (check parameters for reason).
*/
-extern void recent_read_dynamic(char **rf_path_return, int *rf_errno_return);
+extern gboolean recent_read_dynamic(char **rf_path_return, int *rf_errno_return);
/**
* Given a -o command line string, parse it and set the recent value in