This was revealed by Coverity.
CID 1461248
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
+#include <unistd.h>
#define GST_CAT_DEFAULT gstv4l2codecs_debug
GST_DEBUG_CATEGORY_EXTERN (gstv4l2codecs_debug);
gint fd;
struct media_v2_topology topology;
GList *codec_entities, *c;
+ gboolean ret;
fd = open (path, 0);
if (fd < 0)
GST_DEBUG ("Analysing media device '%s'", path);
- if (!get_topology (fd, &topology)) {
+ ret = get_topology (fd, &topology);
+ close (fd);
+
+ if (!ret) {
clear_topology (&topology);
continue;
}