mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 01:32:42 +00:00
v4l2: Fix use after free of fmtdesc part 2
Add missing code in merge commit e890e6e8d8
("v4l2: Fix use after free of fmtdesc"). The v4l2object code was
missing.
Related to https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4317
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4411>
This commit is contained in:
parent
083da950f4
commit
2e76371666
2 changed files with 24 additions and 11 deletions
|
@ -550,6 +550,19 @@ gst_v4l2_object_new (GstElement * element,
|
||||||
return v4l2object;
|
return v4l2object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_v4l2_object_clear_format_list (GstV4l2Object * v4l2object)
|
||||||
|
{
|
||||||
|
g_slist_foreach (v4l2object->formats, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (v4l2object->formats);
|
||||||
|
v4l2object->formats = NULL;
|
||||||
|
v4l2object->fmtdesc = NULL;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_v4l2_object_destroy (GstV4l2Object * v4l2object)
|
gst_v4l2_object_destroy (GstV4l2Object * v4l2object)
|
||||||
{
|
{
|
||||||
|
@ -575,16 +588,6 @@ gst_v4l2_object_destroy (GstV4l2Object * v4l2object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gst_v4l2_object_clear_format_list (GstV4l2Object * v4l2object)
|
|
||||||
{
|
|
||||||
g_slist_foreach (v4l2object->formats, (GFunc) g_free, NULL);
|
|
||||||
g_slist_free (v4l2object->formats);
|
|
||||||
v4l2object->formats = NULL;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gst_v4l2_object_prop_to_cid (guint prop_id)
|
gst_v4l2_object_prop_to_cid (guint prop_id)
|
||||||
{
|
{
|
||||||
|
@ -4663,9 +4666,20 @@ gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, GstCaps * filter)
|
||||||
GstCaps *ret;
|
GstCaps *ret;
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
GSList *formats;
|
GSList *formats;
|
||||||
|
guint32 fourcc = 0;
|
||||||
|
|
||||||
|
if (v4l2object->fmtdesc)
|
||||||
|
fourcc = GST_V4L2_PIXELFORMAT (v4l2object);
|
||||||
|
|
||||||
|
gst_v4l2_object_clear_format_list (v4l2object);
|
||||||
formats = gst_v4l2_object_get_format_list (v4l2object);
|
formats = gst_v4l2_object_get_format_list (v4l2object);
|
||||||
|
|
||||||
|
/* Recover the fmtdesc, it may no longer exist, in which case it will be set
|
||||||
|
* to null */
|
||||||
|
if (fourcc)
|
||||||
|
v4l2object->fmtdesc =
|
||||||
|
gst_v4l2_object_get_format_from_fourcc (v4l2object, fourcc);
|
||||||
|
|
||||||
ret = gst_caps_new_empty ();
|
ret = gst_caps_new_empty ();
|
||||||
|
|
||||||
if (v4l2object->keep_aspect && !v4l2object->par) {
|
if (v4l2object->keep_aspect && !v4l2object->par) {
|
||||||
|
|
|
@ -279,7 +279,6 @@ gboolean gst_v4l2_object_get_property_helper (GstV4l2Object *v4l2objec
|
||||||
gboolean gst_v4l2_object_open (GstV4l2Object * v4l2object, GstV4l2Error * error);
|
gboolean gst_v4l2_object_open (GstV4l2Object * v4l2object, GstV4l2Error * error);
|
||||||
gboolean gst_v4l2_object_open_shared (GstV4l2Object * v4l2object, GstV4l2Object * other);
|
gboolean gst_v4l2_object_open_shared (GstV4l2Object * v4l2object, GstV4l2Object * other);
|
||||||
gboolean gst_v4l2_object_close (GstV4l2Object * v4l2object);
|
gboolean gst_v4l2_object_close (GstV4l2Object * v4l2object);
|
||||||
gboolean gst_v4l2_object_clear_format_list (GstV4l2Object * v4l2object);
|
|
||||||
|
|
||||||
/* probing */
|
/* probing */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue