mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
v4l2: Don't leak v4l2 objects and props on probe errors
This commit is contained in:
parent
03e2655f70
commit
a5369c6be3
1 changed files with 5 additions and 4 deletions
|
@ -100,7 +100,7 @@ static GstV4l2Device *
|
||||||
gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
|
gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
|
||||||
const gchar * device_path, const gchar * device_name, GstStructure * props)
|
const gchar * device_path, const gchar * device_name, GstStructure * props)
|
||||||
{
|
{
|
||||||
GstV4l2Object *v4l2obj;
|
GstV4l2Object *v4l2obj = NULL;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstV4l2Device *device = NULL;
|
GstV4l2Device *device = NULL;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -109,10 +109,10 @@ gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
|
||||||
g_return_val_if_fail (props != NULL, NULL);
|
g_return_val_if_fail (props != NULL, NULL);
|
||||||
|
|
||||||
if (stat (device_path, &st) == -1)
|
if (stat (device_path, &st) == -1)
|
||||||
return NULL;
|
goto destroy;
|
||||||
|
|
||||||
if (!S_ISCHR (st.st_mode))
|
if (!S_ISCHR (st.st_mode))
|
||||||
return NULL;
|
goto destroy;
|
||||||
|
|
||||||
v4l2obj = gst_v4l2_object_new ((GstElement *) provider,
|
v4l2obj = gst_v4l2_object_new ((GstElement *) provider,
|
||||||
V4L2_BUF_TYPE_VIDEO_CAPTURE, device_path, NULL, NULL, NULL);
|
V4L2_BUF_TYPE_VIDEO_CAPTURE, device_path, NULL, NULL, NULL);
|
||||||
|
@ -172,6 +172,7 @@ close:
|
||||||
|
|
||||||
destroy:
|
destroy:
|
||||||
|
|
||||||
|
if (v4l2obj)
|
||||||
gst_v4l2_object_destroy (v4l2obj);
|
gst_v4l2_object_destroy (v4l2obj);
|
||||||
|
|
||||||
if (props)
|
if (props)
|
||||||
|
|
Loading…
Reference in a new issue