From 84b3f20ecc4269bb96ab4ee4bad0b3f921cb2890 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 16 Dec 2021 18:01:30 +0900 Subject: [PATCH] tbm_bufmgr: fix leak of bo data Change-Id: I8eb535679f451f0fb64f3f30094cf7801a121184 --- src/tbm_bufmgr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index c478cde..6d7ac0d 100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -1014,6 +1014,7 @@ tbm_bufmgr_internal_alloc_bo_with_bo_data(tbm_bufmgr bufmgr, tbm_bo_data *bo_dat bo2 = tbm_bufmgr_internal_find_bo(bufmgr, bo); if (bo2) { bo2->ref_cnt++; + free(bo->bo_data); free(bo); _tbm_bufmgr_mutex_unlock(); return bo2; @@ -1064,6 +1065,7 @@ tbm_bufmgr_internal_import_bo_with_key(tbm_bufmgr bufmgr, unsigned int key) TBM_TRACE_BO("find bo(%p) ref(%d) key(%d) flag(%s) in list", bo2, bo2->ref_cnt, key, _tbm_flag_to_str(bo2->flags)); bo2->ref_cnt++; + free(bo->bo_data); free(bo); _tbm_set_last_result(TBM_ERROR_NONE); _tbm_bufmgr_mutex_unlock(); @@ -1130,6 +1132,7 @@ tbm_bufmgr_internal_import_bo_with_fd(tbm_bufmgr bufmgr, tbm_fd fd) TBM_TRACE_BO("find bo(%p) ref(%d) fd(%d) flag(%s) in list", bo2, bo2->ref_cnt, fd, _tbm_flag_to_str(bo2->flags)); bo2->ref_cnt++; + free(bo->bo_data); free(bo); _tbm_set_last_result(TBM_ERROR_NONE); _tbm_bufmgr_mutex_unlock(); -- 2.7.4