From: Boram Park Date: Tue, 12 Dec 2017 23:12:19 +0000 (+0900) Subject: fix the potential memory corruption X-Git-Tag: accepted/tizen/unified/20171213.040917~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f708d3bbabd45573aaed9f10f1df76b28e2945fa;p=platform%2Fadaptation%2Flibtbm-dumb.git fix the potential memory corruption Change-Id: I24837d1d9ddc53268c5ebebde1c499afb1e05303 --- 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));