Fixed segfault with combination of new dfilter struct usage, rfcode,

and File | Open option.

svn path=/trunk/; revision=489
This commit is contained in:
Gilbert Ramirez 1999-08-14 18:51:26 +00:00
parent 2287f6de4e
commit cb61bf1ede
2 changed files with 15 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/* ethereal.c
*
* $Id: ethereal.c,v 1.83 1999/08/13 23:47:41 gram Exp $
* $Id: ethereal.c,v 1.84 1999/08/14 18:51:25 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -421,12 +421,16 @@ static void
file_open_ok_cb(GtkWidget *w, GtkFileSelection *fs) {
gchar *cf_name;
GtkWidget *filter_te;
gchar *rfilter;
gchar *rfilter, *s;
int err;
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 = g_strdup(gtk_entry_get_text(GTK_ENTRY(filter_te)));
s = gtk_entry_get_text(GTK_ENTRY(filter_te));
if (s[0] == '\0')
rfilter = g_strdup(s);
else
rfilter = NULL;
gtk_widget_hide(GTK_WIDGET (fs));
gtk_widget_destroy(GTK_WIDGET (fs));

14
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.66 1999/08/14 04:23:21 guy Exp $
* $Id: file.c,v 1.67 1999/08/14 18:51:26 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -565,11 +565,13 @@ wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset,
passed = TRUE;
if (rfcode) {
protocol_tree = proto_tree_create_root();
dissect_packet(buf, fdata, protocol_tree);
passed = dfilter_apply(rfcode, protocol_tree, cf->pd);
proto_tree_free(protocol_tree);
}
if (DFILTER_CONTAINS_FILTER(rfcode)) {
protocol_tree = proto_tree_create_root();
dissect_packet(buf, fdata, protocol_tree);
passed = dfilter_apply(rfcode, protocol_tree, cf->pd);
proto_tree_free(protocol_tree);
}
}
if (passed) {
plist_end = cf->plist_end;
if (plist_end != NULL)