aboutsummaryrefslogtreecommitdiffstats
path: root/ui/tap-tcp-stream.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-04-05 00:23:35 -0700
committerGuy Harris <guy@alum.mit.edu>2019-04-05 08:15:40 +0000
commit9445403f9558901dc54c88754ff21795ea1803f3 (patch)
treea5e826dcb7275201015395e84558eed0032b043c /ui/tap-tcp-stream.c
parent053cf161734b243f836bed2870c5ea44382e2f52 (diff)
Get rid of the per-capture_file wtap_rec and Buffer.
Most code that reads from a capture_file already has its own wtap_rec and Buffer; change the remaining ones to do so as well. Change-Id: I9b7c136642bbb375848c37ebe23c9cdeffe830c3 Reviewed-on: https://code.wireshark.org/review/32732 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/tap-tcp-stream.c')
-rw-r--r--ui/tap-tcp-stream.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c
index f0ce7144cd..af168941df 100644
--- a/ui/tap-tcp-stream.c
+++ b/ui/tap-tcp-stream.c
@@ -272,6 +272,8 @@ struct tcpheader *
select_tcpip_session(capture_file *cf, struct segment *hdrs)
{
frame_data *fdata;
+ wtap_rec rec;
+ Buffer buf;
epan_dissect_t edt;
dfilter_t *sfcode;
gchar *err_msg;
@@ -293,7 +295,11 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
}
/* dissect the current record */
- if (!cf_read_record(cf, fdata)) {
+ wtap_rec_init(&rec);
+ ws_buffer_init(&buf, 1500);
+ if (!cf_read_record(cf, fdata, &rec, &buf)) {
+ wtap_rec_cleanup(&rec);
+ ws_buffer_free(&buf);
return NULL; /* error reading the record */
}
@@ -308,8 +314,8 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
epan_dissect_prime_with_dfilter(&edt, sfcode);
- epan_dissect_run_with_taps(&edt, cf->cd_t, &cf->rec,
- frame_tvbuff_new_buffer(&cf->provider, fdata, &cf->buf),
+ epan_dissect_run_with_taps(&edt, cf->cd_t, &rec,
+ frame_tvbuff_new_buffer(&cf->provider, fdata, &buf),
fdata, NULL);
rel_ts = edt.pi.rel_ts;
epan_dissect_cleanup(&edt);
@@ -320,6 +326,8 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
* even be enabled if the selected packet isn't a TCP
* segment, as tcp_graph_selected_packet_enabled() is used
* to determine whether to enable any of our menu items. */
+ wtap_rec_cleanup(&rec);
+ ws_buffer_free(&buf);
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Selected packet isn't a TCP segment or is truncated");
return NULL;
@@ -329,6 +337,8 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
*/
if (th.num_hdrs > 1) {
/* can only handle a single tcp layer yet */
+ wtap_rec_cleanup(&rec);
+ ws_buffer_free(&buf);
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The selected packet has more than one TCP unique conversation "
"in it.");
@@ -352,6 +362,8 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
hdrs->th_seglen = th.tcphdrs[0]->th_seglen;
copy_address(&hdrs->ip_src, &th.tcphdrs[0]->ip_src);
copy_address(&hdrs->ip_dst, &th.tcphdrs[0]->ip_dst);
+ wtap_rec_cleanup(&rec);
+ ws_buffer_free(&buf);
return th.tcphdrs[0];
}