mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
v4l2codecs: Fix FD leak during device enumeration
This was revealed by Coverity. CID 1461248
This commit is contained in:
parent
d59bd5f674
commit
8f0ceba251
1 changed files with 6 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gstv4l2codecs_debug
|
#define GST_CAT_DEFAULT gstv4l2codecs_debug
|
||||||
GST_DEBUG_CATEGORY_EXTERN (gstv4l2codecs_debug);
|
GST_DEBUG_CATEGORY_EXTERN (gstv4l2codecs_debug);
|
||||||
|
@ -312,6 +313,7 @@ gst_v4l2_codec_find_devices (void)
|
||||||
gint fd;
|
gint fd;
|
||||||
struct media_v2_topology topology;
|
struct media_v2_topology topology;
|
||||||
GList *codec_entities, *c;
|
GList *codec_entities, *c;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
fd = open (path, 0);
|
fd = open (path, 0);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
@ -319,7 +321,10 @@ gst_v4l2_codec_find_devices (void)
|
||||||
|
|
||||||
GST_DEBUG ("Analysing media device '%s'", path);
|
GST_DEBUG ("Analysing media device '%s'", path);
|
||||||
|
|
||||||
if (!get_topology (fd, &topology)) {
|
ret = get_topology (fd, &topology);
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
clear_topology (&topology);
|
clear_topology (&topology);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue