YaGL: Prevent potential null pointer dereference in yagl_render_finish() 32/245632/1
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Fri, 9 Oct 2020 17:22:21 +0000 (19:22 +0200)
committerSylwester Nawrocki <s.nawrocki@samsung.com>
Tue, 13 Oct 2020 10:07:38 +0000 (12:07 +0200)
This suppresses SVACE warning:

* DEREF_OF_NULL.RET.PROC.STAT: Return value of a function 'yagl_get_context' is dereferenced at yagl_render.c:78 without checking,
  but it is usually checked for this function (10/11).
     [dereference] Dereference at /home/abuild/rpmbuild/BUILD/emulator-yagl-1.6/EGL/yagl_render.c:78
     [counter-example] counter-example: yagl_get_context at EGL/yagl_egl_calls.c:2421
     [counter-example] counter-example: yagl_get_context at EGL/yagl_egl_calls.c:2102
     [counter-example] counter-example: yagl_get_context at EGL/yagl_egl_calls.c:1457
     [counter-example] counter-example: yagl_get_context at EGL/yagl_egl_calls.c:1418
     [counter-example] counter-example: yagl_get_context at EGL/yagl_egl_calls.c:1293
     [counter-example] counter-example: yagl_get_context at EGL/yagl_egl_calls.c:1012

Change-Id: Ie8d33b96af61e9a15e2a5ece46cdd6e63acc2d24
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
EGL/yagl_render.c

index de117b12ec8766471af4803ac23f8bbeb90cd963..e67925af6b3aa4d59ce182c838396855a09e385e 100644 (file)
@@ -75,5 +75,7 @@ void yagl_render_finish()
         yagl_transport_flush(yagl_get_transport(), NULL);
     }
 
-    yagl_context_finish(ctx);
+    if (ctx) {
+        yagl_context_finish(ctx);
+    }
 }