mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +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,
|
||||
const gchar * device_path, const gchar * device_name, GstStructure * props)
|
||||
{
|
||||
GstV4l2Object *v4l2obj;
|
||||
GstV4l2Object *v4l2obj = NULL;
|
||||
GstCaps *caps;
|
||||
GstV4l2Device *device = NULL;
|
||||
struct stat st;
|
||||
|
@ -109,10 +109,10 @@ gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
|
|||
g_return_val_if_fail (props != NULL, NULL);
|
||||
|
||||
if (stat (device_path, &st) == -1)
|
||||
return NULL;
|
||||
goto destroy;
|
||||
|
||||
if (!S_ISCHR (st.st_mode))
|
||||
return NULL;
|
||||
goto destroy;
|
||||
|
||||
v4l2obj = gst_v4l2_object_new ((GstElement *) provider,
|
||||
V4L2_BUF_TYPE_VIDEO_CAPTURE, device_path, NULL, NULL, NULL);
|
||||
|
@ -172,7 +172,8 @@ close:
|
|||
|
||||
destroy:
|
||||
|
||||
gst_v4l2_object_destroy (v4l2obj);
|
||||
if (v4l2obj)
|
||||
gst_v4l2_object_destroy (v4l2obj);
|
||||
|
||||
if (props)
|
||||
gst_structure_free (props);
|
||||
|
|
Loading…
Reference in a new issue