webrtcbin: Fixed memory leak in gstwebrtcstats

The function _get_stats_from_ice_transport returns a string which must be
freed by the caller. However, _get_stats_from_dtls_transport was ignoring
the return value from this function, resulting in a leak.

Ran this with valgrind. Before this fix there was a leak of 40 bytes each
time this was called. After there was no leak.
This commit is contained in:
Sam Gigliotti 2019-08-28 17:26:00 -07:00 committed by Luis de Bethencourt
parent 02814a43da
commit 90d939ea36

View file

@ -353,6 +353,7 @@ _get_stats_from_dtls_transport (GstWebRTCBin * webrtc,
GstStructure *stats;
gchar *id;
double ts;
gchar *ice_id;
gst_structure_get_double (s, "timestamp", &ts);
@ -395,7 +396,8 @@ _get_stats_from_dtls_transport (GstWebRTCBin * webrtc,
gst_structure_set (s, id, GST_TYPE_STRUCTURE, stats, NULL);
gst_structure_free (stats);
_get_stats_from_ice_transport (webrtc, transport->transport, s);
ice_id = _get_stats_from_ice_transport (webrtc, transport->transport, s);
g_free (ice_id);
return id;
}