aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-05-11 00:03:37 -0400
committerJohn Thacker <johnthacker@gmail.com>2023-05-12 20:07:58 +0000
commitf8f9112f9a58985b7c8f081e8da19b089ad5065d (patch)
tree9700dc36c7176f62f69458e2ed340d9114c0c0b8
parentaa525292252795a1b4e3191ea75621fd71b9aace (diff)
Qt: Fix leaks VOIP Calls Dialog
There's still one small leak because RTP streams pass ownership of an rtpstream_info_t to sequence analysis, which doesn't know how to free it.
-rw-r--r--epan/sequence_analysis.c8
-rw-r--r--epan/sequence_analysis.h8
-rw-r--r--ui/qt/voip_calls_dialog.cpp5
-rw-r--r--ui/voip_calls.c7
-rw-r--r--ui/voip_calls.h6
5 files changed, 24 insertions, 10 deletions
diff --git a/epan/sequence_analysis.c b/epan/sequence_analysis.c
index 966617de5f..d061e31b67 100644
--- a/epan/sequence_analysis.c
+++ b/epan/sequence_analysis.c
@@ -193,6 +193,14 @@ static void sequence_analysis_item_free(gpointer data)
free_address(&seq_item->src_addr);
free_address(&seq_item->dst_addr);
if (seq_item->info_ptr) {
+#if 0
+ /* XXX: If seq_item->info_type is GA_INFO_TYPE_RTP, then we need
+ * to free the data, but rtpstream_info_free_* is in libui and
+ * not exported. */
+ if (seq_item->info_type == GA_INFO_TYPE_RTP) {
+ rtpstream_info_free_data((rtpstream_info_t *)seq_item->info_ptr);
+ }
+#endif
g_free(seq_item->info_ptr);
}
g_free(data);
diff --git a/epan/sequence_analysis.h b/epan/sequence_analysis.h
index 393e639041..59913e52db 100644
--- a/epan/sequence_analysis.h
+++ b/epan/sequence_analysis.h
@@ -34,6 +34,12 @@ extern "C" {
#define MAX_NUM_NODES 40
+/** defines info types for graph analysis additional information */
+typedef enum _ga_info_type {
+ GA_INFO_TYPE_NONE=0,
+ GA_INFO_TYPE_RTP
+} ga_info_type;
+
/** defines an entry for the graph analysis */
typedef struct _seq_analysis_item {
guint32 frame_number;
@@ -52,7 +58,7 @@ typedef struct _seq_analysis_item {
guint src_node; /**< this is used by graph_analysis.c to identify the node */
guint dst_node; /**< a node is an IP address that will be displayed in columns */
guint16 line_style; /**< the arrow line width in pixels*/
- guint32 info_type; /**< type of info for item */
+ ga_info_type info_type; /**< type of info for item */
gpointer info_ptr; /**< ptr to info for item */
} seq_analysis_item_t;
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index 9071102609..b8a54bd757 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -327,7 +327,10 @@ void VoipCallsDialog::tapReset(void *tapinfo_ptr)
VoipCallsDialog *voip_calls_dialog = static_cast<VoipCallsDialog *>(tapinfo->tap_data);
// Create new callsinfos queue in tapinfo. Current callsinfos are
- // in shown_callsinfos_.
+ // in shown_callsinfos_, so don't free the [shared] data stored in
+ // the queue, but do free the queue itself. (Do this before calling
+ // voip_calls_reset_all_taps(), as that frees the data in the queue.)
+ g_queue_free(voip_calls_dialog->tapinfo_.callsinfos);
voip_calls_dialog->tapinfo_.callsinfos = g_queue_new();
voip_calls_reset_all_taps(tapinfo);
diff --git a/ui/voip_calls.c b/ui/voip_calls.c
index 62576ddab0..703f4d981a 100644
--- a/ui/voip_calls.c
+++ b/ui/voip_calls.c
@@ -280,7 +280,7 @@ voip_calls_reset_all_taps(voip_calls_tapinfo_t *tapinfo)
/* free the SIP_HASH */
if(NULL!=tapinfo->callsinfo_hashtable[SIP_HASH])
{
- g_hash_table_remove_all (tapinfo->callsinfo_hashtable[SIP_HASH]);
+ g_hash_table_destroy(tapinfo->callsinfo_hashtable[SIP_HASH]);
tapinfo->callsinfo_hashtable[SIP_HASH] = NULL;
}
@@ -289,12 +289,15 @@ voip_calls_reset_all_taps(voip_calls_tapinfo_t *tapinfo)
while(list)
{
strinfo = (rtpstream_info_t *)list->data;
- rtpstream_info_free_data(strinfo);
+ rtpstream_info_free_all(strinfo);
list = g_list_next(list);
}
g_list_free(tapinfo->rtpstream_list);
tapinfo->rtpstream_list = NULL;
+ g_free(tapinfo->sdp_summary);
+ tapinfo->sdp_summary = NULL;
+
if (tapinfo->h245_labels) {
memset(tapinfo->h245_labels, 0, sizeof(h245_labels_t));
}
diff --git a/ui/voip_calls.h b/ui/voip_calls.h
index 97f0824a8d..d2878b7c48 100644
--- a/ui/voip_calls.h
+++ b/ui/voip_calls.h
@@ -140,12 +140,6 @@ typedef struct _skinny_calls_info {
guint32 callId;
} skinny_calls_info_t;
-/** defines info types for graph analysis additional information */
-typedef enum _ga_info_type {
- GA_INFO_TYPE_NONE=0,
- GA_INFO_TYPE_RTP
-} ga_info_type;
-
/** defines a voip call */
typedef struct _voip_calls_info {
voip_call_state call_state;