From e109bee380c5be22e886d12b8b776e8df30be481 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 13 Feb 2019 04:23:54 +0000 Subject: [PATCH] Fix some clang-analyzer complains Signed-off-by: Yuxuan Shui --- src/opengl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/opengl.c b/src/opengl.c index 7ad7a59..82f75fe 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -496,6 +496,11 @@ glx_bind_pixmap(session_t *ps, glx_texture_t **pptex, xcb_pixmap_t pixmap, glx_texture_t *ptex = *pptex; bool need_release = true; + // Release pixmap if parameters are inconsistent + if (ptex && ptex->texture && ptex->pixmap != pixmap) { + glx_release_pixmap(ps, ptex); + } + // Allocate structure if (!ptex) { static const glx_texture_t GLX_TEX_DEF = { @@ -509,18 +514,12 @@ glx_bind_pixmap(session_t *ps, glx_texture_t **pptex, xcb_pixmap_t pixmap, }; ptex = cmalloc(glx_texture_t); - allocchk(ptex); memcpy(ptex, &GLX_TEX_DEF, sizeof(glx_texture_t)); *pptex = ptex; } - // Release pixmap if parameters are inconsistent - if (ptex->texture && ptex->pixmap != pixmap) { - glx_release_pixmap(ps, ptex); - } - // Create GLX pixmap - unsigned depth; + unsigned depth = 0; if (!ptex->glpixmap) { need_release = false;