webrtc: Fix memory leak in icestream

Since both g_value_set_object() and g_weak_ref_get() takes a reference
there will be two new references to the GstWebRTCICE object when there
should be only one. g_value_take_object() has the same functionality as
g_value_set_object() but does not take a reference.

Without this change, the GstWebRTCICE object will be leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2333>
This commit is contained in:
Ludvig Rappe 2022-04-28 17:08:11 +02:00 committed by GStreamer Marge Bot
parent 9cd6f9d51e
commit 26263c194e

View file

@ -83,7 +83,7 @@ gst_webrtc_ice_stream_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_ICE:
g_value_set_object (value, g_weak_ref_get (&stream->ice_weak));
g_value_take_object (value, g_weak_ref_get (&stream->ice_weak));
break;
case PROP_STREAM_ID:
g_value_set_uint (value, stream->stream_id);