From c4ffd6a41f6ecbf81d59d327b68fc87ab0f20d99 Mon Sep 17 00:00:00 2001 From: manxiaoliang Date: Wed, 19 Feb 2025 02:11:53 +0000 Subject: [PATCH] Fixed some coverity issues * Double free * Double close Tracked-On: OAM-129205 Signed-off-by: manxiaoliang --- cros_gralloc/cros_gralloc_driver.cc | 2 -- xe.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index 39784c4..7ad4964 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -205,8 +205,6 @@ 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); continue; } diff --git a/xe.c b/xe.c index 5aaa310..15b59c4 100644 --- a/xe.c +++ b/xe.c @@ -428,6 +428,8 @@ static int xe_init(struct driver *drv) if (!xe_query_device_info(drv, xe)) { drv_loge("Failed to query device id using DRM_IOCTL_XE_DEVICE_QUERY"); + if (!xe) + free(xe); return -EINVAL; }