diff options
author | Guy Harris <gharris@sonic.net> | 2021-08-29 19:12:13 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-08-29 19:12:13 -0700 |
commit | 3cb6403a4caecd763e8e9a45a81160aac0644515 (patch) | |
tree | 3a321d42c17675aee99bcde1a6e59b5f9f146a91 /wiretap/visual.c | |
parent | eb2037fda4e3310c00ed4afb73195f3c4a9f27c9 (diff) | |
download | wireshark-3cb6403a4caecd763e8e9a45a81160aac0644515.tar.gz wireshark-3cb6403a4caecd763e8e9a45a81160aac0644515.tar.bz2 wireshark-3cb6403a4caecd763e8e9a45a81160aac0644515.zip |
wiretap: always allocate a block for a record.
Without that, you could add a comment to a record in a file format the
reading code for which doesn't allocate blocks, but the comment doesn't
get saved, as there's no block in which to save the comment option.
This simplifies some code paths, as we're either using the record's
modified block or we're using the block as read from the file, there's
no third possibility.
If we attempt to read a record, and we get an error, and a block was
allocated for the record, unreference it, so the individual file readers
don't have to worry about it.
Diffstat (limited to 'wiretap/visual.c')
-rw-r--r-- | wiretap/visual.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/wiretap/visual.c b/wiretap/visual.c index 8b6035f54d..bc0ea26ad5 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -331,6 +331,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, packet_size = pletoh16(&vpkt_hdr.incl_len); rec->rec_type = REC_TYPE_PACKET; + rec->block = wtap_block_create(WTAP_BLOCK_PACKET); rec->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; /* Set the packet time and length. */ |