multifilesrc: fix caps leak
authorCélestin Marot <marotcelestin@gmail.com>
Fri, 10 Dec 2021 16:36:30 +0000 (17:36 +0100)
committerCélestin Marot <marotcelestin@gmail.com>
Fri, 10 Dec 2021 17:34:57 +0000 (18:34 +0100)
since `gst_caps_replace()` and `gst_pad_set_caps()` both ref the caps and neither of them takes the ownership of the caps -> it must be unreffed in `gst_multi_file_src_set_property()`

to test the leak (on Unix): `echo coucou > /tmp/file.txt && GST_TRACERS=leaks GST_DEBUG="GST_TRACER:7" gst-launch-1.0 multifilesrc location=/tmp/file.txt caps='txt' ! fakesink`

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

subprojects/gst-plugins-good/gst/multifile/gstmultifilesrc.c

index b2fabc8..48221b9 100644 (file)
@@ -343,6 +343,7 @@ gst_multi_file_src_set_property (GObject * object, guint prop_id,
         src->fps_n = -1;
         src->fps_d = -1;
       }
+      gst_caps_unref (new_caps);
     }
       break;
     case PROP_LOOP: