summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoram Park <boram1288.park@samsung.com>2017-12-13 08:12:19 +0900
committerBoram Park <boram1288.park@samsung.com>2017-12-13 08:14:33 +0900
commitf708d3bbabd45573aaed9f10f1df76b28e2945fa (patch)
tree8a2e05835ec5d412e081bf1a1f1811a4e094d06f
parent2cdfb7fcfeab223202f73da717a2bb13cff9290c (diff)
downloadlibtbm-dumb-f708d3bbabd45573aaed9f10f1df76b28e2945fa.tar.gz
libtbm-dumb-f708d3bbabd45573aaed9f10f1df76b28e2945fa.tar.bz2
libtbm-dumb-f708d3bbabd45573aaed9f10f1df76b28e2945fa.zip
fix the potential memory corruption
Change-Id: I24837d1d9ddc53268c5ebebde1c499afb1e05303
-rw-r--r--src/tbm_bufmgr_dumb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tbm_bufmgr_dumb.c b/src/tbm_bufmgr_dumb.c
index 01705b1..bca0d4a 100644
--- a/src/tbm_bufmgr_dumb.c
+++ b/src/tbm_bufmgr_dumb.c
@@ -485,7 +485,7 @@ tbm_dumb_bo_alloc(tbm_bo bo, int size, int flags)
static void
tbm_dumb_bo_free(tbm_bo bo)
{
- tbm_bo_dumb bo_dumb;
+ tbm_bo_dumb bo_dumb, temp;
tbm_bufmgr_dumb bufmgr_dumb;
if (!bo)
@@ -519,12 +519,15 @@ tbm_dumb_bo_free(tbm_bo bo)
/* delete bo from hash */
int ret;
- ret = drmHashLookup(bufmgr_dumb->hashBos, bo_dumb->name, (void**)&bo_dumb);
+ ret = drmHashLookup(bufmgr_dumb->hashBos, bo_dumb->name, (void**)&temp);
if (ret == 0)
drmHashDelete(bufmgr_dumb->hashBos, bo_dumb->name);
else
TBM_DUMB_LOG("warning Cannot find bo to Hash(%d), ret =%d\n", bo_dumb->name, ret);
+ if (temp != bo_dumb)
+ TBM_DUMB_LOG("hashBos probably has several BOs with same name!!!\n");
+
/* Free gem handle */
struct drm_gem_close arg = {0, };
memset(&arg, 0, sizeof(arg));