diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index 39784c45..655c827c 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -174,7 +174,7 @@ cros_gralloc_driver::cros_gralloc_driver(): drivers_(GPU_GRP_TYPE_NR, nullptr) int fallback_fd = -1; drmVersionPtr version; const int render_num = 10; - std::vector driver_fds{GPU_GRP_TYPE_NR, -1}; + std::vector driver_fds(GPU_GRP_TYPE_NR, -1); char buf[PROP_VALUE_MAX]; property_get("ro.product.device", buf, "unknown"); @@ -204,11 +204,8 @@ cros_gralloc_driver::cros_gralloc_driver(): drivers_(GPU_GRP_TYPE_NR, nullptr) } // hit any of undesired render node - if (j < ARRAY_SIZE(undesired)) { - drmFreeVersion(version); - close(fd); + if (j < ARRAY_SIZE(undesired)) continue; - } if (fallback_fd == -1) fallback_fd = fd; @@ -255,7 +252,8 @@ cros_gralloc_driver::cros_gralloc_driver(): drivers_(GPU_GRP_TYPE_NR, nullptr) if (!(gpu_grp_type_ & (1ull << i))) continue; if (drivers_[i] != nullptr) { - DRV_DESTROY(drivers_[i]); + drv_destroy(drivers_[i]); + drivers_[i] = nullptr; } struct driver *drv = drv_create(driver_fds[i], gpu_grp_type_); if (!drv) {