summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2024-09-17 14:27:46 -0400
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-09-23 19:58:52 +0000
commita6959f3738c6548f4c0eb99b1612c8dab0501c43 (patch)
treeffa8b5972883597270532620424e8f4b47e68e6a
parentd35f348af3fbec56df52e86bc008912c81e1c3c2 (diff)
v4l2: dec/enc: Flag leaked caps
We never free class held template caps, so flag the one that wasn't already flagged. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7540>
-rw-r--r--subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c5
-rw-r--r--subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c
index c7f39ddee2..7814bae03d 100644
--- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c
+++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c
@@ -1446,11 +1446,16 @@ gst_v4l2_video_dec_register (GstPlugin * plugin, const gchar * basename,
cdata->device = g_strdup (device_path);
cdata->sink_caps = gst_caps_new_empty ();
gst_caps_append_structure (cdata->sink_caps, gst_structure_copy (s));
+ GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
+ GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
cdata->src_caps = gst_caps_ref (src_caps);
type_name = gst_v4l2_video_dec_set_metadata (s, cdata, basename);
/* Skip over if we hit an unmapped type */
if (!type_name) {
+ g_free (cdata->device);
+ gst_caps_unref (cdata->sink_caps);
+ gst_caps_unref (cdata->src_caps);
g_free (cdata);
continue;
}
diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c
index 88af1a85dc..ac382fbc94 100644
--- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c
+++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c
@@ -1227,6 +1227,7 @@ gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
GValue value = G_VALUE_INIT;
filtered_caps = gst_caps_intersect (src_caps, codec_caps);
+ GST_MINI_OBJECT_FLAG_SET (filtered_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
if (codec != NULL && video_fd != -1) {
if (gst_v4l2_codec_probe_levels (codec, video_fd, &value)) {
@@ -1243,7 +1244,7 @@ gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
cdata = g_new0 (GstV4l2VideoEncCData, 1);
cdata->device = g_strdup (device_path);
cdata->sink_caps = gst_caps_ref (sink_caps);
- cdata->src_caps = gst_caps_ref (filtered_caps);
+ cdata->src_caps = filtered_caps;
cdata->codec = codec;
g_type_query (type, &type_query);