aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/file_dlg.c11
-rw-r--r--gtk/main.c11
2 files changed, 12 insertions, 10 deletions
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index 571dd1c47f..09e4fdd3d3 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -1,7 +1,7 @@
/* file_dlg.c
* Dialog boxes for handling files
*
- * $Id: file_dlg.c,v 1.9 1999/10/11 06:39:25 guy Exp $
+ * $Id: file_dlg.c,v 1.10 1999/10/12 05:01:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -121,12 +121,9 @@ file_open_ok_cb(GtkWidget *w, GtkFileSelection *fs) {
cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION (fs)));
filter_te = gtk_object_get_data(GTK_OBJECT(w), E_RFILTER_TE_KEY);
rfilter = gtk_entry_get_text(GTK_ENTRY(filter_te));
- if (rfilter[0] != '\0') {
- rfcode = dfilter_compile(rfilter);
- if (rfcode != NULL) {
- simple_dialog(ESD_TYPE_WARN, NULL, dfilter_error_msg);
- return;
- }
+ if (dfilter_compile(rfilter, &rfcode) != 0) {
+ simple_dialog(ESD_TYPE_WARN, NULL, dfilter_error_msg);
+ return;
}
/* Try to open the capture file. */
diff --git a/gtk/main.c b/gtk/main.c
index f58481ea4c..7a747cff2e 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.20 1999/10/11 18:02:46 guy Exp $
+ * $Id: main.c,v 1.21 1999/10/12 05:01:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -862,14 +862,16 @@ main(int argc, char *argv[])
up on top of us. */
if (cf_name) {
if (rfilter != NULL) {
- rfcode = dfilter_compile(rfilter);
- if (rfcode == NULL) {
+ if (dfilter_compile(rfilter, &rfcode) != 0) {
simple_dialog(ESD_TYPE_WARN, NULL, dfilter_error_msg);
rfilter_parse_failed = TRUE;
}
}
if (!rfilter_parse_failed) {
if ((err = open_cap_file(cf_name, &cf)) == 0) {
+ /* "open_cap_file()" succeeded, so it closed the previous
+ capture file, and thus destroyed any previous read filter
+ attached to "cf". */
cf.rfcode = rfcode;
err = read_cap_file(&cf);
s = strrchr(cf_name, '/');
@@ -878,6 +880,9 @@ main(int argc, char *argv[])
*s = '\0';
}
set_menu_sensitivity("/File/Save As...", TRUE);
+ } else {
+ dfilter_destroy(rfcode);
+ cf.rfcode = NULL;
}
}
}