v4l2object: fix memory leak

The tmp caps should be unreffed as the template structure.

The leaks can be reproduced with
gst-launch-1.0 v4l2src num-buffers=1 ! autovideosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8669>
This commit is contained in:
Stéphane Cerveau 2025-03-24 15:32:22 +01:00 committed by GStreamer Marge Bot
parent 5aaa4c2c5a
commit 9183df0226

View File

@ -3124,6 +3124,7 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object,
v4l2object->max_height = maxh;
}
} else {
gst_structure_free (template);
goto unknown_type;
}
@ -3139,6 +3140,7 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object,
results = g_list_delete_link (results, results);
}
gst_structure_free (template);
if (gst_caps_is_empty (ret))
goto enum_framesizes_no_results;
@ -5388,6 +5390,7 @@ gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, GstCaps * filter)
gst_caps_append (interlaced_caps, filtered_caps);
gst_caps_unref (filter);
gst_caps_unref (tmp);
}
if (sysmem_tmpl)