diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-10-25 19:24:06 +0100 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-10-26 11:06:51 +0000 |
commit | e2203f5aed1eef900c7568b6d14f3e303e271b7c (patch) | |
tree | acdb69aa22bab5ee178d3713d2cbfcf82557f0bb | |
parent | 5dffa81e8cc45dfefb974768e90533097ecee996 (diff) |
Qt: fix memory leaks in VoIP calls window
- Add free of h245_labels to voip_calls_remove_all_tap_listeners() so that memory is not leaked with Qt GUI
- Call voip_calls_reset_all_taps() from VoipCallsDialog destructor so as to free allocated memory
Change-Id: I46945b5d475d8c1267819021a4ed2782c531a0c6
Reviewed-on: https://code.wireshark.org/review/11268
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r-- | ui/qt/voip_calls_dialog.cpp | 2 | ||||
-rw-r--r-- | ui/voip_calls.c | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp index 38b919c94a..486e3a604c 100644 --- a/ui/qt/voip_calls_dialog.cpp +++ b/ui/qt/voip_calls_dialog.cpp @@ -214,8 +214,10 @@ VoipCallsDialog::~VoipCallsDialog() { delete ui; + voip_calls_reset_all_taps(&tapinfo_); voip_calls_remove_all_tap_listeners(&tapinfo_); sequence_analysis_info_free(tapinfo_.graph_analysis); + g_queue_free(tapinfo_.callsinfos); } void VoipCallsDialog::captureFileClosing() diff --git a/ui/voip_calls.c b/ui/voip_calls.c index 17643d796f..fff48ef5c6 100644 --- a/ui/voip_calls.c +++ b/ui/voip_calls.c @@ -290,13 +290,7 @@ voip_calls_reset_all_taps(voip_calls_tapinfo_t *tapinfo) g_list_free(tapinfo->rtp_stream_list); tapinfo->rtp_stream_list = NULL; - if (!tapinfo->h245_labels) { - /* - * XXX - given that we set this in fff, will this ever be - * the case? - */ - tapinfo->h245_labels = g_new0(h245_labels_t, 1); - } else { + if (tapinfo->h245_labels) { memset(tapinfo->h245_labels, 0, sizeof(h245_labels_t)); } @@ -2222,7 +2216,9 @@ h245dg_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { GString *error_string; - tap_id_base->h245_labels = g_new0(h245_labels_t, 1); + if (!tap_id_base->h245_labels) { + tap_id_base->h245_labels = g_new0(h245_labels_t, 1); + } error_string = register_tap_listener("h245dg", tap_base_to_id(tap_id_base, tap_id_offset_h245dg_), NULL, 0, @@ -2242,6 +2238,10 @@ h245dg_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) void remove_tap_listener_h245dg_calls(voip_calls_tapinfo_t *tap_id_base) { + if (tap_id_base->h245_labels) { + g_free(tap_id_base->h245_labels); + tap_id_base->h245_labels = NULL; + } remove_tap_listener(tap_base_to_id(tap_id_base, tap_id_offset_h245dg_)); } |