OSDN Git Service

Revert "Added Support for 64bit RGB format"
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc_driver.cc
index 615cb61..f78c7e0 100644 (file)
@@ -9,9 +9,11 @@
 
 #include "i915_private_android.h"
 
+#include <errno.h>
 #include <cstdlib>
 #include <fcntl.h>
 #include <xf86drm.h>
+#include <unistd.h>
 
 cros_gralloc_driver::cros_gralloc_driver() : drv_(nullptr)
 {
@@ -58,11 +60,14 @@ int32_t cros_gralloc_driver::init()
                                continue;
 
                        version = drmGetVersion(fd);
-                       if (!version)
+                       if (!version) {
+                               close(fd);
                                continue;
+            }
 
                        if (undesired[i] && !strcmp(version->name, undesired[i])) {
                                drmFreeVersion(version);
+                               close(fd);
                                continue;
                        }