From 93ba663e8f4b9ca339de5ec5bb4e3d9d4dd6e4be Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 May 2021 18:22:55 +0900 Subject: [PATCH] Add null checking to prevent problem. Change-Id: Icd94a00b015b5100e6beaa59d435731836a2d376 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 8 ++++++-- src/tpl_wl_vk_thread.c | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index c564ae1..7813981 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2548,12 +2548,16 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface, return TPL_ERROR_INVALID_PARAMETER; } + wl_egl_buffer = _get_wl_egl_buffer(tbm_surface); + if (!wl_egl_buffer) { + TPL_ERR("Failed to get wl_egl_buffer from tbm_surface(%p)", tbm_surface); + return TPL_ERROR_INVALID_PARAMETER; + } + bo_name = _get_tbm_surface_bo_name(tbm_surface); TRACE_MARK("[ENQ] BO_NAME:%d", bo_name); - wl_egl_buffer = _get_wl_egl_buffer(tbm_surface); - tpl_gmutex_lock(&wl_egl_buffer->mutex); /* If there are received region information, save it to wl_egl_buffer */ diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index 4ae5b55..4ea1a68 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -2067,6 +2067,11 @@ __tpl_wl_vk_surface_enqueue_buffer(tpl_surface_t *surface, TPL_ERROR_INVALID_PARAMETER); wl_vk_buffer = _get_wl_vk_buffer(tbm_surface); + if (!wl_vk_buffer) { + TPL_ERR("Failed to get wl_vk_buffer from tbm_surface(%p)", tbm_surface); + return TPL_ERROR_INVALID_PARAMETER; + } + bo_name = wl_vk_buffer->bo_name; tpl_gmutex_lock(&wl_vk_buffer->mutex); -- 2.34.1