[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1566238098-3962-1-git-send-email-wenwen@cs.uga.edu>
Date: Mon, 19 Aug 2019 13:08:18 -0500
From: Wenwen Wang <wenwen@...uga.edu>
To: Wenwen Wang <wenwen@...uga.edu>
Cc: Dave Airlie <airlied@...hat.com>,
Gerd Hoffmann <kraxel@...hat.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
virtualization@...ts.linux-foundation.org (open list:DRM DRIVER FOR QXL
VIRTUAL GPU),
spice-devel@...ts.freedesktop.org (open list:DRM DRIVER FOR QXL VIRTUAL
GPU), dri-devel@...ts.freedesktop.org (open list:DRM DRIVERS),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] drm/qxl: fix a memory leak bug
In qxl_bo_create(), the temporary 'bo' is allocated through kzalloc().
However, it is not deallocated in the following execution if ttm_bo_init()
fails, leading to a memory leak bug. To fix this issue, free 'bo' before
returning the error.
Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
---
drivers/gpu/drm/qxl/qxl_object.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c
index 4928fa6..3b217fa 100644
--- a/drivers/gpu/drm/qxl/qxl_object.c
+++ b/drivers/gpu/drm/qxl/qxl_object.c
@@ -118,6 +118,7 @@ int qxl_bo_create(struct qxl_device *qdev,
dev_err(qdev->ddev.dev,
"object_init failed for (%lu, 0x%08X)\n",
size, domain);
+ kfree(bo);
return r;
}
*bo_ptr = bo;
--
2.7.4
Powered by blists - more mailing lists