From: Philippe Normand Date: Sat, 26 Mar 2022 12:36:46 +0000 (+0000) Subject: webrtc: Refactor ICECandidateStats freeing logic to a dedicated function X-Git-Tag: 1.22.0~1566 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c19319c7774d701b5c7ae23ac15f3c1dea3d4c0d;p=platform%2Fupstream%2Fgstreamer.git webrtc: Refactor ICECandidateStats freeing logic to a dedicated function Part-of: --- diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c index 8b1ce70..5e796e1 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c @@ -1006,6 +1006,17 @@ gst_webrtc_ice_get_selected_pair (GstWebRTCICE * ice, return FALSE; } +void +gst_webrtc_ice_candidate_stats_free (GstWebRTCICECandidateStats * stats) +{ + if (stats) { + g_free (stats->ipaddr); + g_free (stats->url); + } + + g_free (stats); +} + static void _clear_ice_stream (struct NiceStreamItem *item) { diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.h b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.h index 831ca1c..7e20902 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.h +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.h @@ -128,6 +128,9 @@ gboolean gst_webrtc_ice_get_selected_pair (GstWebRTCIC GstWebRTCICEStream * stream, GstWebRTCICECandidateStats ** local_stats, GstWebRTCICECandidateStats ** remote_stats); + +void gst_webrtc_ice_candidate_stats_free (GstWebRTCICECandidateStats * stats); + G_END_DECLS #endif /* __GST_WEBRTC_ICE_H__ */ diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c index da3a4a6..c628fc1 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c @@ -711,15 +711,8 @@ _get_stats_from_ice_transport (GstWebRTCBin * webrtc, g_free (local_cand_id); g_free (remote_cand_id); - if (local_cand) { - g_free (local_cand->ipaddr); - g_free (local_cand->url); - } - if (remote_cand) - g_free (remote_cand->ipaddr); - - g_free (local_cand); - g_free (remote_cand); + gst_webrtc_ice_candidate_stats_free (local_cand); + gst_webrtc_ice_candidate_stats_free (remote_cand); gst_structure_free (stats);