Fix some clang-analyzer complains

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-13 04:23:54 +00:00
parent 7cdc0aedee
commit e109bee380
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 6 additions and 7 deletions

View File

@ -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;