From: Sylwester Nawrocki Date: Wed, 14 Oct 2020 12:05:15 +0000 (+0200) Subject: YaGL: Prevent potential null pointer dereference in yagl_egl_release_current_context() X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cfdb088c3951b707f4160e5cbbce16397ffaf88;p=sdk%2Femulator%2Fqemu.git YaGL: Prevent potential null pointer dereference in yagl_egl_release_current_context() This fixes a potential NULL pointer dereference issue as pointed out by SVACE warning: * DEREF_OF_NULL.ASSIGN: Pointer 'egl_api_ts', which is dereferenced at yagl_host_egl_calls.c:184, may have NULL value. [dereference] Dereference at hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c:184 [null] Assign null at hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c:182 Change-Id: I5003403ebc881fb2ebc91d9e1be132ff4d87f2e3 Signed-off-by: Sylwester Nawrocki --- diff --git a/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c b/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c index 46f120f..a8fbb57 100644 --- a/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c +++ b/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c @@ -179,7 +179,13 @@ static __inline bool yagl_validate_context(struct yagl_thread_state *cur_ts, static bool yagl_egl_release_current_context(struct yagl_thread_state *cur_ts, struct yagl_egl_display *dpy) { - struct yagl_egl_api_ts *egl_api_ts = (cur_ts ? cur_ts->egl_api_ts : NULL); + struct yagl_egl_api_ts *egl_api_ts; + + if (!cur_ts) { + return false; + } + + egl_api_ts = cur_ts->egl_api_ts; if (!egl_api_ts->context) { return true;