From 84cea40c6d74d58231ca3dba11649c73d754a907 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 13 Dec 2017 08:12:19 +0900 Subject: [PATCH] fix the potential memory corruption Change-Id: I9deb4b85ffa187d7460b5c465a0c11880bbec006 --- src/tbm_bufmgr_exynos.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tbm_bufmgr_exynos.c b/src/tbm_bufmgr_exynos.c index e914646..e893881 100644 --- a/src/tbm_bufmgr_exynos.c +++ b/src/tbm_bufmgr_exynos.c @@ -1101,7 +1101,7 @@ tbm_exynos_bo_alloc(tbm_bo bo, int size, int flags) static void tbm_exynos_bo_free(tbm_bo bo) { - tbm_bo_exynos bo_exynos; + tbm_bo_exynos bo_exynos, temp; tbm_bufmgr_exynos bufmgr_exynos; char buf[STRERR_BUFSIZE]; @@ -1137,7 +1137,7 @@ tbm_exynos_bo_free(tbm_bo bo) int ret; ret = drmHashLookup(bufmgr_exynos->hashBos, bo_exynos->name, - (void **)&bo_exynos); + (void **)&temp); if (ret == 0) { drmHashDelete(bufmgr_exynos->hashBos, bo_exynos->name); } else { @@ -1145,6 +1145,9 @@ tbm_exynos_bo_free(tbm_bo bo) bo_exynos->name, ret); } + if (temp != bo_exynos) + TBM_EXYNOS_ERROR("hashBos probably has several BOs with same name!!!\n"); + _bo_destroy_cache_state(bufmgr_exynos, bo_exynos); /* Free gem handle */ -- 2.7.4