Fix for bug #3119 (follow_tcp crash when stream filter creation fails)

svn path=/trunk/; revision=26995
This commit is contained in:
Bill Meier 2008-12-14 17:06:25 +00:00
parent ee3c49e36c
commit f2dbebb885
1 changed files with 14 additions and 5 deletions

View File

@ -118,6 +118,18 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
follow_info = g_new0(follow_info_t, 1);
follow_info->follow_type = FOLLOW_TCP;
/* Create a new filter that matches all packets in the TCP stream,
and set the display filter entry accordingly */
reset_tcp_reassembly();
follow_filter = build_follow_filter(&cfile.edt->pi);
if (!follow_filter) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Error creating filter for this stream.\n"
"A transport or network layer header is needed");
g_free(follow_info);
return;
}
/* Create a temporary file into which to dump the reassembled data
from the TCP stream, and set "data_out_file" to refer to it, so
that the TCP code will write to it.
@ -134,6 +146,7 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
"Could not create temporary file %s: %s",
follow_info->data_out_filename, strerror(errno));
g_free(follow_info);
g_free(follow_filter);
return;
}
@ -145,14 +158,10 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
ws_close(tmp_fd);
ws_unlink(follow_info->data_out_filename);
g_free(follow_info);
g_free(follow_filter);
return;
}
/* Create a new filter that matches all packets in the TCP stream,
and set the display filter entry accordingly */
reset_tcp_reassembly();
follow_filter = build_follow_filter(&cfile.edt->pi);
/* Set the display filter entry accordingly */
filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);