RTP: Fix rtpdump export

Broke by 87973bf516.

RtpStreamDialog allocates its own rtpstream_info_t, and copies the original stream's info.

Then RtpStreamDialog::on_actionExportAsRtpDump_triggered calls
rtpstream_save with this copy.

On save, reset_tap_listeners is called, and it clears all the tree items,
destroying the allocated copy *before* it is used for the actual export.

Trace:
1   rtpstream_info_free_all                             tap-rtp-common.c       104
2   RtpStreamTreeWidgetItem::~RtpStreamTreeWidgetItem   rtp_stream_dialog.cpp  85
3   RtpStreamTreeWidgetItem::~RtpStreamTreeWidgetItem   rtp_stream_dialog.cpp  86
4   QTreeModel::clear()
5   RtpStreamDialog::tapReset                           rtp_stream_dialog.cpp  309
6   rtpstream_reset_cb                                  tap-rtp-common.c       172
7   reset_tap_listeners                                 tap.c                  418
8   cf_retap_packets                                    file.c                 2243
9   rtpstream_save                                      rtp_stream.c           97
10  RtpStreamDialog::on_actionExportAsRtpDump_triggered rtp_stream_dialog.cpp  515

Bug: 16351
Change-Id: I54d37a2c97997395936df94ee5481b0d6d198aed
Reviewed-on: https://code.wireshark.org/review/35979
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Orgad Shaneh 2020-01-29 09:05:45 +02:00 committed by Anders Broman
parent aaad273ec1
commit eb0dcc984f
1 changed files with 2 additions and 7 deletions

View File

@ -74,17 +74,12 @@ class RtpStreamTreeWidgetItem : public QTreeWidgetItem
{
public:
RtpStreamTreeWidgetItem(QTreeWidget *tree, rtpstream_info_t *stream_info) :
QTreeWidgetItem(tree, rtp_stream_type_)
QTreeWidgetItem(tree, rtp_stream_type_),
stream_info_(stream_info)
{
stream_info_=rtpstream_info_malloc_and_copy_deep(stream_info);
drawData();
}
~RtpStreamTreeWidgetItem()
{
rtpstream_info_free_all(stream_info_);
}
rtpstream_info_t *streamInfo() const { return stream_info_; }
void drawData() {