If we've thrown away saved state before a rescan of the frames in a

capture, clear the per-frame data pointers of all frames in the capture,
as those pointers now refer to data that's been freed.

Do that to all frames even if the user stops the rescan in the middle -
and clear the "visited" flag for all frames as well.

svn path=/trunk/; revision=2361
This commit is contained in:
Guy Harris 2000-08-24 09:16:39 +00:00
parent 5765a6e587
commit 781eb21d46
1 changed files with 21 additions and 2 deletions

23
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.211 2000/08/24 06:45:37 guy Exp $
* $Id: file.c,v 1.212 2000/08/24 09:16:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -979,8 +979,11 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
if (redissect) {
/* Since all state for the frame was destroyed, mark the frame
* as not visited. */
* as not visited, and null out the pointer to the per-frame
* data (the per-frame data itself was freed by
* "init_all_protocols()"). */
fdata->flags.visited = 0;
fdata->pfd = NULL;
}
wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
@ -992,6 +995,22 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
selected_row = row;
}
if (redissect) {
/* Clear out what remains of the visited flags and per-frame data
pointers.
XXX - that may cause various forms of bogosity when dissecting
these frames, as they won't have been seen by this sequential
pass, but the only alternative I see is to keep scanning them
even though the user requested that the scan stop, and that
would leave the user stuck with an Ethereal grinding on
until it finishes. Should we just stick them with that? */
for (; fdata != NULL; fdata = fdata->next) {
fdata->flags.visited = 0;
fdata->pfd = NULL;
}
}
/* We're done filtering the packets; destroy the progress bar. */
destroy_progress_dlg(progbar);