gst-play: Don't leak the stream collection
authorEdward Hervey <edward@centricular.com>
Fri, 14 Oct 2022 14:12:45 +0000 (16:12 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sat, 15 Oct 2022 03:04:06 +0000 (03:04 +0000)
We are given a reference to the collection when parsing it from the
message. Just store it (instead of referencing it again).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3186>

subprojects/gst-plugins-base/tools/gst-play.c

index 3025e04..c66c77a 100644 (file)
@@ -620,8 +620,9 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
 
       if (collection) {
         g_mutex_lock (&play->selection_lock);
-        gst_object_replace ((GstObject **) & play->collection,
-            (GstObject *) collection);
+        if (play->collection)
+          gst_object_unref (play->collection);
+        play->collection = collection;
         g_mutex_unlock (&play->selection_lock);
       }
       break;