data_link_info->description = g_strdup(lt_parts[2]);
else
data_link_info->description = NULL;
+ g_strfreev(lt_parts);
linktype_list = g_list_append(linktype_list, data_link_info);
}
g_free(linktype_info->name);
g_free(linktype_info->description);
+ g_free(linktype_info);
}
void
g_string_append (cols_hidden, ",");
g_string_append (cols_hidden, prefs_fmt);
}
+ g_free(prefs_fmt);
clp = clp->next;
}
g_free(sc_item->name);
g_free(sc_item);
}
+ g_list_free(sc->cache_list);
g_free(sc);
}
/* 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 &&
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);
(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) {
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;
}
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? */
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
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;
splash_overlay_ = new SplashOverlay(this);
}
+MainWelcome::~MainWelcome()
+{
+ delete welcome_ui_;
+}
+
InterfaceTree *MainWelcome::getInterfaceTree()
{
return welcome_ui_->interfaceTree;
Q_OBJECT
public:
explicit MainWelcome(QWidget *parent = 0);
+ virtual ~MainWelcome();
InterfaceTree *getInterfaceTree();
protected:
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);
(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) {
/* 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;
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
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;
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
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;
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
if (errno != ENOENT) {
*rf_errno_return = errno;
*rf_path_return = rf_path;
+ return FALSE;
}
}
+ g_free(rf_path);
+ return TRUE;
}
gint
*
* @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
/* Read the profile independent recent file. We have to do this here so we can */
/* set the profile before it can be set from the command line parameter */
- recent_read_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_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, strerror(rf_open_errno));
+ g_free(rf_path);
}
/* Init the "Open file" dialog directory */
/* 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);
}
// Initialize our language
/* 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 &&
/* 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);