From 0a840b5dd83151134e06df9584aa1ac9fa712b42 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Wed, 18 Jan 2023 20:56:36 -0500 Subject: [PATCH] Follow: Remove check for FOLLOW_TCP for fragments in Qt Only TCP uses fragments, but we don't need to check FOLLOW_TCP because the fragments pointers exist but are null if not being used. See the similar code in epan/follow.c Part of making it simpler for dissectors to register with Follow. --- ui/qt/follow_stream_dialog.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index 417761b79d..c6edb8be46 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -533,24 +533,22 @@ void FollowStreamDialog::resetStream() g_list_free(follow_info_.payload); //Only TCP stream uses fragments - if (follow_type_ == FOLLOW_TCP) { - for (cur = follow_info_.fragments[0]; cur; cur = gxx_list_next(cur)) { - follow_record = gxx_list_data(follow_record_t *, cur); - if (follow_record->data) { - g_byte_array_free(follow_record->data, TRUE); - } - g_free(follow_record); + for (cur = follow_info_.fragments[0]; cur; cur = gxx_list_next(cur)) { + follow_record = gxx_list_data(follow_record_t *, cur); + if (follow_record->data) { + g_byte_array_free(follow_record->data, TRUE); } - follow_info_.fragments[0] = Q_NULLPTR; - for (cur = follow_info_.fragments[1]; cur; cur = gxx_list_next(cur)) { - follow_record = gxx_list_data(follow_record_t *, cur); - if (follow_record->data) { - g_byte_array_free(follow_record->data, TRUE); - } - g_free(follow_record); - } - follow_info_.fragments[1] = Q_NULLPTR; + g_free(follow_record); } + follow_info_.fragments[0] = Q_NULLPTR; + for (cur = follow_info_.fragments[1]; cur; cur = gxx_list_next(cur)) { + follow_record = gxx_list_data(follow_record_t *, cur); + if (follow_record->data) { + g_byte_array_free(follow_record->data, TRUE); + } + g_free(follow_record); + } + follow_info_.fragments[1] = Q_NULLPTR; free_address(&follow_info_.client_ip); free_address(&follow_info_.server_ip);