tbm_bo: initialize the bo->user_data_list at bo_free 17/260317/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 23 Jun 2021 04:52:54 +0000 (13:52 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 23 Jun 2021 07:14:00 +0000 (16:14 +0900)
instead of LIST_INITHEAD at tbm_bo_import_fd

Change-Id: I97550425189bcf596614baf7dabca66866478af3

src/tbm_bo.c

index 658f852..2f47978 100644 (file)
@@ -561,8 +561,6 @@ tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd)
                /* LCOV_EXCL_STOP */
        }
 
-       LIST_INITHEAD(&bo->user_data_list); // TODO: remove this. build-break when it is removed.
-
        TBM_TRACE_BO("import bo(%p) ref(%d) fd(%d) flag(%s)\n",
                        bo, bo->ref_cnt, fd, _tbm_flag_to_str(bo->flags));
 
@@ -845,11 +843,12 @@ _tbm_bo_free(tbm_bo bo)
        if (!LIST_IS_EMPTY(&bo->user_data_list)) {
                tbm_user_data *old_data = NULL, *tmp;
 
-               LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp,
-                               &bo->user_data_list, item_link) {
+               LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, &bo->user_data_list, item_link) {
                        TBM_DBG("free user_data\n");
                        user_data_delete(old_data);
                }
+
+               LIST_INITHEAD(&bo->user_data_list); // TODO: remove this. build-break when it is removed.
        }
 
        while (bo->lock_cnt > 0) {