aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-04 23:33:28 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:50 -0700
commitb6109de34f04747ed2937a2e63c1f53740202d3e (patch)
tree6578024b65adc9dc2bc3bd4a23cf44f29808b3b2
parentda3282b6e2f374b88daf09f7f3ba5b05af45f51a (diff)
Remove useless checks for NULL before freeing
Same as earlier commit, except for "FREE" This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + FREE (E); + E = NULL; - if (unlikely (E != NULL)) { - FREE(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; type T; @@ + FREE ((T) E); + E = NULL; - if (unlikely (E != NULL)) { - FREE((T) E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + FREE (E); - if (unlikely (E != NULL)) { - FREE (E); - } @@ expression E; type T; @@ + FREE ((T) E); - if (unlikely (E != NULL)) { - FREE ((T) E); - } Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c3
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c6
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c22
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.c3
-rw-r--r--src/gallium/auxiliary/util/u_format.c8
-rw-r--r--src/gallium/drivers/i915/i915_resource_texture.c3
-rw-r--r--src/gallium/drivers/i915/i915_state.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c4
-rw-r--r--src/gallium/drivers/nv30/nvfx_fragprog.c10
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c12
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c6
-rw-r--r--src/gallium/drivers/nvc0/nvc0_program.c12
-rw-r--r--src/gallium/drivers/nvc0/nvc0_screen.c6
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c3
-rw-r--r--src/gallium/drivers/r300/r300_state.c3
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c9
-rw-r--r--src/gallium/state_trackers/egl/drm/modeset.c6
-rw-r--r--src/gallium/state_trackers/egl/drm/native_drm.c6
-rw-r--r--src/gallium/state_trackers/egl/gdi/native_gdi.c3
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_drm.c6
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_shm.c3
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c9
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c3
-rw-r--r--src/gallium/state_trackers/vega/text.c3
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c3
-rw-r--r--src/gallium/targets/graw-xlib/graw_xlib.c3
-rw-r--r--src/gallium/winsys/sw/dri/dri_sw_winsys.c4
28 files changed, 55 insertions, 115 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index b2b40871af7..c5647268595 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -435,9 +435,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
shader->in_prim_idx = 0;
shader->input_vertex_stride = input_stride;
shader->input = input;
- if (shader->primitive_lengths) {
- FREE(shader->primitive_lengths);
- }
+ FREE(shader->primitive_lengths);
shader->primitive_lengths = MALLOC(max_out_prims * sizeof(unsigned));
tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index fe96e5c9d49..453cf45b86e 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -287,8 +287,7 @@ if(mm->heap)
u_mmDestroy(mm->heap);
if(mm->map)
pb_unmap(mm->buffer);
- if(mm)
- FREE(mm);
+ FREE(mm);
return NULL;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index a8e9a34d519..67a19fe8a68 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
@@ -311,13 +311,11 @@ pool_bufmgr_create(struct pb_manager *provider,
return SUPER(pool);
failure:
- if(pool->bufs)
- FREE(pool->bufs);
+ FREE(pool->bufs);
if(pool->map)
pb_unmap(pool->buffer);
if(pool->buffer)
pb_reference(&pool->buffer, NULL);
- if(pool)
- FREE(pool);
+ FREE(pool);
return NULL;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 5e23f5da65b..68bb598cf3c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -653,15 +653,11 @@ tgsi_exec_machine_bind_shader(
if (!tokens) {
/* unbind and free all */
- if (mach->Declarations) {
- FREE( mach->Declarations );
- }
+ FREE(mach->Declarations);
mach->Declarations = NULL;
mach->NumDeclarations = 0;
- if (mach->Instructions) {
- FREE( mach->Instructions );
- }
+ FREE(mach->Instructions);
mach->Instructions = NULL;
mach->NumInstructions = 0;
@@ -804,15 +800,11 @@ tgsi_exec_machine_bind_shader(
}
tgsi_parse_free (&parse);
- if (mach->Declarations) {
- FREE( mach->Declarations );
- }
+ FREE(mach->Declarations);
mach->Declarations = declarations;
mach->NumDeclarations = numDeclarations;
- if (mach->Instructions) {
- FREE( mach->Instructions );
- }
+ FREE(mach->Instructions);
mach->Instructions = instructions;
mach->NumInstructions = numInstructions;
}
@@ -875,10 +867,8 @@ void
tgsi_exec_machine_destroy(struct tgsi_exec_machine *mach)
{
if (mach) {
- if (mach->Instructions)
- FREE(mach->Instructions);
- if (mach->Declarations)
- FREE(mach->Declarations);
+ FREE(mach->Instructions);
+ FREE(mach->Declarations);
align_free(mach->Inputs);
align_free(mach->Outputs);
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index 469c874988d..81c4f107ea9 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -151,6 +151,5 @@ out:
if (vbuf)
pipe_resource_reference(&vbuf, NULL);
- if (v)
- FREE(v);
+ FREE(v);
}
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 6f452983592..a41c468a95d 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -618,13 +618,9 @@ util_format_translate(enum pipe_format dst_format,
src_row += src_step;
}
- if (tmp_s) {
- FREE(tmp_s);
- }
+ FREE(tmp_s);
- if (tmp_z) {
- FREE(tmp_z);
- }
+ FREE(tmp_z);
return;
}
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index e60b5b435cc..603a379d0c8 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -705,8 +705,7 @@ i915_texture_destroy(struct pipe_screen *screen,
iws->buffer_destroy(iws, tex->buffer);
for (i = 0; i < Elements(tex->image_offset); i++)
- if (tex->image_offset[i])
- FREE(tex->image_offset[i]);
+ FREE(tex->image_offset[i]);
FREE(tex);
}
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index fdbff8b4a4e..410615f212a 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -614,10 +614,8 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
{
struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader;
- if (ifs->decl) {
- FREE(ifs->decl);
- ifs->decl = NULL;
- }
+ FREE(ifs->decl);
+ ifs->decl = NULL;
if (ifs->program) {
FREE(ifs->program);
@@ -625,6 +623,7 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
FREE((struct tgsi_token *)ifs->state.tokens);
ifs->state.tokens = NULL;
}
+
ifs->program_len = 0;
ifs->decl_len = 0;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 36041432312..924881c7030 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -184,9 +184,7 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
fail:
for (level = 0; level <= pt->last_level; level++) {
- if (lpr->layout[level]) {
- FREE(lpr->layout[level]);
- }
+ FREE(lpr->layout[level]);
}
return FALSE;
diff --git a/src/gallium/drivers/nv30/nvfx_fragprog.c b/src/gallium/drivers/nv30/nvfx_fragprog.c
index bfec4b3569b..935804e8e14 100644
--- a/src/gallium/drivers/nv30/nvfx_fragprog.c
+++ b/src/gallium/drivers/nv30/nvfx_fragprog.c
@@ -1101,10 +1101,9 @@ nvfx_fragprog_prepare(struct nv30_context* nvfx, struct nvfx_fpc *fpc)
return TRUE;
out_err:
- if (fpc->r_temp) {
- FREE(fpc->r_temp);
- fpc->r_temp = NULL;
- }
+ FREE(fpc->r_temp);
+ fpc->r_temp = NULL;
+
tgsi_parse_free(&p);
return FALSE;
}
@@ -1218,8 +1217,7 @@ out:
tgsi_parse_free(&parse);
if(fpc)
{
- if (fpc->r_temp)
- FREE(fpc->r_temp);
+ FREE(fpc->r_temp);
util_dynarray_fini(&fpc->if_stack);
util_dynarray_fini(&fpc->label_relocs);
util_dynarray_fini(&fpc->imm_data);
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 72d14a6e3a0..0d292f7ab89 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -343,8 +343,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset)
NOUVEAU_ERR("shader translation failed: %i\n", ret);
goto out;
}
- if (info->bin.syms) /* we don't need them yet */
- FREE(info->bin.syms);
+ FREE(info->bin.syms);
prog->code = info->bin.code;
prog->code_size = info->bin.codeSize;
@@ -428,14 +427,11 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p)
if (p->mem)
nouveau_heap_free(&p->mem);
- if (p->code)
- FREE(p->code);
+ FREE(p->code);
- if (p->fixups)
- FREE(p->fixups);
+ FREE(p->fixups);
- if (p->so)
- FREE(p->so);
+ FREE(p->so);
memset(p, 0, sizeof(*p));
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 3d510ea5f35..beb81d66476 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -267,8 +267,7 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
if (screen->base.pushbuf)
screen->base.pushbuf->user_priv = NULL;
- if (screen->blitctx)
- FREE(screen->blitctx);
+ FREE(screen->blitctx);
nouveau_bo_ref(NULL, &screen->code);
nouveau_bo_ref(NULL, &screen->tls_bo);
@@ -281,8 +280,7 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
nouveau_heap_destroy(&screen->gp_code_heap);
nouveau_heap_destroy(&screen->fp_code_heap);
- if (screen->tic.entries)
- FREE(screen->tic.entries);
+ FREE(screen->tic.entries);
nouveau_object_del(&screen->tesla);
nouveau_object_del(&screen->eng2d);
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
index f228d07bf6b..9655e18de52 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -574,8 +574,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset)
NOUVEAU_ERR("shader translation failed: %i\n", ret);
goto out;
}
- if (info->bin.syms) /* we don't need them yet */
- FREE(info->bin.syms);
+ FREE(info->bin.syms);
prog->code = info->bin.code;
prog->code_size = info->bin.codeSize;
@@ -752,12 +751,9 @@ nvc0_program_destroy(struct nvc0_context *nvc0, struct nvc0_program *prog)
if (prog->mem)
nouveau_heap_free(&prog->mem);
- if (prog->code)
- FREE(prog->code);
- if (prog->immd_data)
- FREE(prog->immd_data);
- if (prog->relocs)
- FREE(prog->relocs);
+ FREE(prog->code);
+ FREE(prog->immd_data);
+ FREE(prog->relocs);
if (prog->tfb) {
if (nvc0->state.tfb == prog->tfb)
nvc0->state.tfb = NULL;
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c
index eb74e955f52..d4487442a55 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -256,8 +256,7 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
if (screen->base.pushbuf)
screen->base.pushbuf->user_priv = NULL;
- if (screen->blitctx)
- FREE(screen->blitctx);
+ FREE(screen->blitctx);
nouveau_bo_ref(NULL, &screen->text);
nouveau_bo_ref(NULL, &screen->uniform_bo);
@@ -269,8 +268,7 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
nouveau_heap_destroy(&screen->lib_code);
nouveau_heap_destroy(&screen->text_heap);
- if (screen->tic.entries)
- FREE(screen->tic.entries);
+ FREE(screen->tic.entries);
nouveau_mm_destroy(screen->mm_VRAM_fe0);
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 7cb8cd60d3e..f652bf72b0c 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -55,8 +55,7 @@ static void r300_buffer_destroy(struct pipe_screen *screen,
{
struct r300_resource *rbuf = r300_resource(buf);
- if (rbuf->malloced_buffer)
- FREE(rbuf->malloced_buffer);
+ FREE(rbuf->malloced_buffer);
if (rbuf->buf)
pb_reference(&rbuf->buf, NULL);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 6f9feb10564..46a6bf669b7 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1840,8 +1840,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
if (r300->screen->caps.has_tcl) {
rc_constants_destroy(&vs->code.constants);
- if (vs->code.constants_remap_table)
- FREE(vs->code.constants_remap_table);
+ FREE(vs->code.constants_remap_table);
} else {
draw_delete_vertex_shader(r300->draw,
(struct draw_vertex_shader*)vs->draw_vs);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 239be6129e8..86abaebd70e 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -169,8 +169,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
native_connectors =
gdpy->native->modeset->get_connectors(gdpy->native, &num_connectors, NULL);
if (!num_connectors) {
- if (native_connectors)
- FREE(native_connectors);
+ FREE(native_connectors);
return;
}
@@ -184,8 +183,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
native_modes =
gdpy->native->modeset->get_modes(gdpy->native, nconn, &num_modes);
if (!num_modes) {
- if (native_modes)
- FREE(native_modes);
+ FREE(native_modes);
continue;
}
@@ -428,8 +426,7 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
native_configs = gdpy->native->get_configs(gdpy->native, &num_configs);
if (!num_configs) {
- if (native_configs)
- FREE(native_configs);
+ FREE(native_configs);
return id;
}
diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c
index b33323b9d60..32c0a258c6f 100644
--- a/src/gallium/state_trackers/egl/drm/modeset.c
+++ b/src/gallium/state_trackers/egl/drm/modeset.c
@@ -648,10 +648,8 @@ drm_display_fini_modeset(struct native_display *ndpy)
FREE(drmdpy->connectors);
}
- if (drmdpy->shown_surfaces) {
- FREE(drmdpy->shown_surfaces);
- drmdpy->shown_surfaces = NULL;
- }
+ FREE(drmdpy->shown_surfaces);
+ drmdpy->shown_surfaces = NULL;
if (drmdpy->saved_crtcs) {
for (i = 0; i < drmdpy->resources->count_crtcs; i++) {
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c
index feb1dc045bf..23fc137b834 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -123,8 +123,7 @@ drm_display_destroy(struct native_display *ndpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
- if (drmdpy->config)
- FREE(drmdpy->config);
+ FREE(drmdpy->config);
drm_display_fini_modeset(&drmdpy->base);
@@ -132,8 +131,7 @@ drm_display_destroy(struct native_display *ndpy)
ndpy->screen = NULL;
ndpy_uninit(ndpy);
- if (drmdpy->device_name)
- FREE(drmdpy->device_name);
+ FREE(drmdpy->device_name);
if (drmdpy->own_gbm) {
gbm_device_destroy(&drmdpy->gbmdrm->base.base);
diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index 78dbe7cca6c..7b40108884a 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -358,8 +358,7 @@ gdi_display_destroy(struct native_display *ndpy)
{
struct gdi_display *gdpy = gdi_display(ndpy);
- if (gdpy->configs)
- FREE(gdpy->configs);
+ FREE(gdpy->configs);
ndpy_uninit(ndpy);
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index c6f61978ab0..7255c8fc9e2 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -73,10 +73,8 @@ wayland_drm_display_destroy(struct native_display *ndpy)
if (drmdpy->wl_drm)
wl_drm_destroy(drmdpy->wl_drm);
- if (drmdpy->device_name)
- FREE(drmdpy->device_name);
- if (drmdpy->base.configs)
- FREE(drmdpy->base.configs);
+ FREE(drmdpy->device_name);
+ FREE(drmdpy->base.configs);
if (drmdpy->base.own_dpy)
wl_display_disconnect(drmdpy->base.dpy);
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index 574ffce4b66..643bb929af2 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -63,8 +63,7 @@ wayland_shm_display_destroy(struct native_display *ndpy)
{
struct wayland_shm_display *shmdpy = wayland_shm_display(ndpy);
- if (shmdpy->base.configs)
- FREE(shmdpy->base.configs);
+ FREE(shmdpy->base.configs);
if (shmdpy->base.own_dpy)
wl_display_disconnect(shmdpy->base.dpy);
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 70ae0f98443..a989f9e9108 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -260,8 +260,7 @@ dri2_surface_get_buffers(struct native_surface *nsurf, uint buffer_mask)
dri2surf->server_stamp++;
dri2surf->client_stamp = dri2surf->server_stamp;
- if (dri2surf->last_xbufs)
- FREE(dri2surf->last_xbufs);
+ FREE(dri2surf->last_xbufs);
dri2surf->last_xbufs = xbufs;
dri2surf->last_num_xbufs = num_outs;
}
@@ -432,8 +431,7 @@ dri2_surface_destroy(struct native_surface *nsurf)
struct dri2_surface *dri2surf = dri2_surface(nsurf);
int i;
- if (dri2surf->last_xbufs)
- FREE(dri2surf->last_xbufs);
+ FREE(dri2surf->last_xbufs);
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
struct pipe_resource *ptex = dri2surf->textures[i];
@@ -752,8 +750,7 @@ dri2_display_destroy(struct native_display *ndpy)
{
struct dri2_display *dri2dpy = dri2_display(ndpy);
- if (dri2dpy->configs)
- FREE(dri2dpy->configs);
+ FREE(dri2dpy->configs);
if (dri2dpy->base.screen)
dri2dpy->base.screen->destroy(dri2dpy->base.screen);
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index ae9c3b21356..4f09e4627c3 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -511,8 +511,7 @@ ximage_display_destroy(struct native_display *ndpy)
{
struct ximage_display *xdpy = ximage_display(ndpy);
- if (xdpy->configs)
- FREE(xdpy->configs);
+ FREE(xdpy->configs);
ndpy_uninit(ndpy);
diff --git a/src/gallium/state_trackers/vega/text.c b/src/gallium/state_trackers/vega/text.c
index 27d461ce660..14e3cc57551 100644
--- a/src/gallium/state_trackers/vega/text.c
+++ b/src/gallium/state_trackers/vega/text.c
@@ -52,8 +52,7 @@ static VGboolean del_glyph(struct vg_font *font,
glyph = (struct vg_glyph *)
cso_hash_take(font->glyphs, (unsigned) glyphIndex);
- if (glyph)
- FREE(glyph);
+ FREE(glyph);
return (glyph != NULL);
}
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index e65e71dc15f..8e4459c67f7 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -117,8 +117,7 @@ stw_init(const struct stw_winsys *stw_winsys)
return TRUE;
error1:
- if (stw_dev->smapi)
- FREE(stw_dev->smapi);
+ FREE(stw_dev->smapi);
if (stw_dev->stapi)
stw_dev->stapi->destroy(stw_dev->stapi);
diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c
index 6138cf6c01a..28277478064 100644
--- a/src/gallium/targets/graw-xlib/graw_xlib.c
+++ b/src/gallium/targets/graw-xlib/graw_xlib.c
@@ -154,8 +154,7 @@ fail:
if (screen)
screen->destroy(screen);
- if (xlib_handle)
- FREE(xlib_handle);
+ FREE(xlib_handle);
free(visinfo);
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index 1bca827bd65..edb3a381a74 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -121,9 +121,7 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
{
struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
- if (dri_sw_dt->data) {
- FREE(dri_sw_dt->data);
- }
+ FREE(dri_sw_dt->data);
FREE(dri_sw_dt);
}