From 1f45018ee871edd17a570d202b6ef9460cab0ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sat, 6 Jun 2020 17:26:42 -0300 Subject: [PATCH] shader_glsl.c: Move buffer null pointer check in gl_glsl_set_coords() `buffer` is initialized to a statically allocated variable and can only be NULL when the allocation of a bigger buffer fails. When only the core frame is being displayed, the buffer never points to the heap thanks to the small buffer optimization. --- gfx/drivers_shader/shader_glsl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index de76111e0f..ebc4c6a107 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -1443,10 +1443,10 @@ static bool gl_glsl_set_coords(void *shader_data, elems *= coords->vertices * sizeof(GLfloat); buffer = (GLfloat*)malloc(elems); - } - if (!buffer) - return false; + if (!buffer) + return false; + } if (uni->tex_coord >= 0) {