File descriptors are left open and forgotten.
Make sure to clean up fds after use.
Jira: GSE-1595
Test: Build and boot on Android
Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
#include <cstdlib>
#include <fcntl.h>
#include <xf86drm.h>
+#include <unistd.h>
cros_gralloc_driver::cros_gralloc_driver() : drv_(nullptr)
{
continue;
version = drmGetVersion(fd);
- if (!version)
+ if (!version) {
+ close(fd);
continue;
+ }
if (undesired[i] && !strcmp(version->name, undesired[i])) {
drmFreeVersion(version);
+ close(fd);
continue;
}