summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c3
-rw-r--r--src/egl/drivers/dri2/platform_x11.c3
-rw-r--r--src/egl/drivers/glx/egl_glx.c6
-rw-r--r--src/gallium/drivers/r600/r600_shader.c6
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c4
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c9
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c6
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c6
-rw-r--r--src/gallium/state_trackers/vega/shaders_cache.c9
-rw-r--r--src/gallium/state_trackers/xvmc/subpicture.c3
-rw-r--r--src/gallium/targets/graw-xlib/graw_xlib.c3
-rw-r--r--src/glx/dri2_glx.c6
-rw-r--r--src/glx/dri_glx.c6
-rw-r--r--src/glx/drisw_glx.c3
-rw-r--r--src/glx/glxext.c9
-rw-r--r--src/glx/indirect_glx.c12
-rw-r--r--src/glx/indirect_vertex_array.c12
-rw-r--r--src/mesa/drivers/dri/common/xmlconfig.c9
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c6
-rw-r--r--src/mesa/drivers/x11/fakeglx.c4
-rw-r--r--src/mesa/main/atifragshader.c12
-rw-r--r--src/mesa/main/bufferobj.c3
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/imports.c3
-rw-r--r--src/mesa/main/shaderapi.c4
-rw-r--r--src/mesa/main/shaderobj.c9
-rw-r--r--src/mesa/main/texcompress_cpal.c3
-rw-r--r--src/mesa/main/texcompress_fxt1.c4
-rw-r--r--src/mesa/program/arbprogparse.c12
-rw-r--r--src/mesa/program/nvfragparse.c8
-rw-r--r--src/mesa/program/nvvertparse.c8
-rw-r--r--src/mesa/program/prog_instruction.c6
-rw-r--r--src/mesa/program/prog_parameter.c3
-rw-r--r--src/mesa/program/program.c3
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c3
-rw-r--r--src/mesa/swrast/s_context.c3
-rw-r--r--src/mesa/swrast/s_drawpix.c4
-rw-r--r--src/mesa/swrast/s_renderbuffer.c12
-rw-r--r--src/mesa/swrast/s_texture.c6
-rw-r--r--src/mesa/tnl/t_vb_texgen.c4
-rw-r--r--src/mesa/vbo/vbo_primitive_restart.c4
-rw-r--r--src/mesa/vbo/vbo_rebase.c6
-rw-r--r--src/mesa/vbo/vbo_save_api.c6
46 files changed, 88 insertions, 184 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f2cce747e7a..f99bcad3081 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -611,8 +611,7 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
close(dri2_dpy->fd);
if (dri2_dpy->driver)
dlclose(dri2_dpy->driver);
- if (dri2_dpy->device_name)
- free(dri2_dpy->device_name);
+ free(dri2_dpy->device_name);
if (disp->PlatformDisplay == NULL) {
switch (disp->Platform) {
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 7486a91ec0c..f7dc89dc992 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -581,8 +581,7 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id)
if (authenticate == NULL || !authenticate->authenticated)
ret = -1;
- if (authenticate)
- free(authenticate);
+ free(authenticate);
return ret;
}
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 7181145ae89..8fe19f94c1f 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -655,10 +655,8 @@ GLX_eglTerminate(_EGLDriver *drv, _EGLDisplay *disp)
_eglReleaseDisplayResources(drv, disp);
_eglCleanupDisplay(disp);
- if (GLX_dpy->visuals)
- free(GLX_dpy->visuals);
- if (GLX_dpy->fbconfigs)
- free(GLX_dpy->fbconfigs);
+ free(GLX_dpy->visuals);
+ free(GLX_dpy->fbconfigs);
if (!disp->PlatformDisplay)
XCloseDisplay(GLX_dpy->dpy);
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index da8be0bbc17..3e797645ed9 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -4997,10 +4997,8 @@ static void fc_pushlevel(struct r600_shader_ctx *ctx, int type)
static void fc_poplevel(struct r600_shader_ctx *ctx)
{
struct r600_cf_stack_entry *sp = &ctx->bc->fc_stack[ctx->bc->fc_sp];
- if (sp->mid) {
- free(sp->mid);
- sp->mid = NULL;
- }
+ free(sp->mid);
+ sp->mid = NULL;
sp->num_mid = 0;
sp->start = NULL;
sp->type = 0;
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index 34be89a1197..b9c51279100 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -217,9 +217,7 @@ __glXFreeDisplayPrivate(XExtData * extension)
priv = (__GLXdisplayPrivate *) extension->private_data;
FreeScreenConfigs(priv);
- if (priv->serverGLXversion)
- free((char *) priv->serverGLXversion);
-
+ free((char *) priv->serverGLXversion);
free((char *) priv);
return 0;
}
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index 47d9a69c7dd..effac0e711d 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -95,10 +95,8 @@ x11_screen_destroy(struct x11_screen *xscr)
{
if (xscr->dri_fd >= 0)
close(xscr->dri_fd);
- if (xscr->dri_driver)
- free(xscr->dri_driver);
- if (xscr->dri_device)
- free(xscr->dri_device);
+ free(xscr->dri_driver);
+ free(xscr->dri_device);
#ifdef GLX_DIRECT_RENDERING
/* xscr->glx_dpy will be destroyed with the X display */
@@ -106,8 +104,7 @@ x11_screen_destroy(struct x11_screen *xscr)
xscr->glx_dpy->xscr = NULL;
#endif
- if (xscr->visuals)
- free(xscr->visuals);
+ free(xscr->visuals);
FREE(xscr);
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 4b81755dcfa..7e915567a43 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -168,10 +168,8 @@ xmesa_init_display( Display *display )
xmdpy->screen->destroy(xmdpy->screen);
xmdpy->screen = NULL;
}
- if (xmdpy->smapi) {
- free(xmdpy->smapi);
- xmdpy->smapi = NULL;
- }
+ free(xmdpy->smapi);
+ xmdpy->smapi = NULL;
xmdpy->display = NULL;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index ee425ec2b59..7b54df5998c 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -278,10 +278,8 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b)
stfbi = CALLOC_STRUCT(st_framebuffer_iface);
xstfb = CALLOC_STRUCT(xmesa_st_framebuffer);
if (!stfbi || !xstfb) {
- if (stfbi)
- free(stfbi);
- if (xstfb)
- free(xstfb);
+ free(stfbi);
+ free(xstfb);
return NULL;
}
diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c
index 29463843bb7..eceae54051e 100644
--- a/src/gallium/state_trackers/vega/shaders_cache.c
+++ b/src/gallium/state_trackers/vega/shaders_cache.c
@@ -238,12 +238,9 @@ combine_shaders(const struct shader_asm_info *shaders[SHADER_STAGES], int num_sh
ureg_destroy(ureg);
- if (temp)
- free(temp);
- if (constant)
- free(constant);
- if (sampler)
- free(sampler);
+ free(temp);
+ free(constant);
+ free(sampler);
return p;
}
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
index f9f646b7496..8e96ce66dc0 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -115,8 +115,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, int xvi
subpictures = XvMCListSubpictureTypes(dpy, port, surface_type_id, &num_subpics);
if (num_subpics < 1) {
- if (subpictures)
- free(subpictures);
+ free(subpictures);
return BadMatch;
}
if (!subpictures)
diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c
index 95b856815db..6138cf6c01a 100644
--- a/src/gallium/targets/graw-xlib/graw_xlib.c
+++ b/src/gallium/targets/graw-xlib/graw_xlib.c
@@ -157,8 +157,7 @@ fail:
if (xlib_handle)
FREE(xlib_handle);
- if (visinfo)
- free(visinfo);
+ free(visinfo);
if (win)
XDestroyWindow(graw.display, win);
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 7978bfd4633..5644f665c4c 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -126,8 +126,7 @@ dri2_destroy_context(struct glx_context *context)
driReleaseDrawables(&pcp->base);
- if (context->extensions)
- free((char *) context->extensions);
+ free((char *) context->extensions);
(*psc->core->destroyContext) (pcp->driContext);
@@ -313,8 +312,7 @@ dri2_create_context_attribs(struct glx_screen *base,
return &pcp->base;
error_exit:
- if (pcp != NULL)
- free(pcp);
+ free(pcp);
return NULL;
}
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index b2fced95222..a158de023ba 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -495,8 +495,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
if (framebuffer.base != MAP_FAILED)
drmUnmap((drmAddress) framebuffer.base, framebuffer.size);
- if (framebuffer.dev_priv != NULL)
- free(framebuffer.dev_priv);
+ free(framebuffer.dev_priv);
if (fd >= 0)
drmCloseOnce(fd);
@@ -516,8 +515,7 @@ dri_destroy_context(struct glx_context * context)
driReleaseDrawables(&pcp->base);
- if (context->extensions)
- free((char *) context->extensions);
+ free((char *) context->extensions);
(*psc->core->destroyContext) (pcp->driContext);
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index d98fdb903d0..b68e62272c7 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -255,8 +255,7 @@ drisw_destroy_context(struct glx_context *context)
driReleaseDrawables(&pcp->base);
- if (context->extensions)
- free((char *) context->extensions);
+ free((char *) context->extensions);
(*psc->core->destroyContext) (pcp->driContext);
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 3827b583b7a..729ca5f073c 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -230,10 +230,8 @@ glx_display_free(struct glx_display *priv)
}
FreeScreenConfigs(priv);
- if (priv->serverGLXvendor)
- free((char *) priv->serverGLXvendor);
- if (priv->serverGLXversion)
- free((char *) priv->serverGLXversion);
+ free((char *) priv->serverGLXvendor);
+ free((char *) priv->serverGLXversion);
__glxHashDestroy(priv->glXDrawHash);
@@ -740,8 +738,7 @@ glx_screen_cleanup(struct glx_screen *psc)
{
if (psc->configs) {
glx_config_destroy_list(psc->configs);
- if (psc->effectiveGLXexts)
- free(psc->effectiveGLXexts);
+ free(psc->effectiveGLXexts);
psc->configs = NULL; /* NOTE: just for paranoia */
}
if (psc->visuals) {
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index 53d5a914db7..5eef59c1d5a 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -45,14 +45,10 @@ indirect_destroy_context(struct glx_context *gc)
{
__glXFreeVertexArrayState(gc);
- if (gc->vendor)
- free((char *) gc->vendor);
- if (gc->renderer)
- free((char *) gc->renderer);
- if (gc->version)
- free((char *) gc->version);
- if (gc->extensions)
- free((char *) gc->extensions);
+ free((char *) gc->vendor);
+ free((char *) gc->renderer);
+ free((char *) gc->version);
+ free((char *) gc->extensions);
__glFreeAttributeState(gc);
free((char *) gc->buf);
free((char *) gc->client_state_private);
diff --git a/src/glx/indirect_vertex_array.c b/src/glx/indirect_vertex_array.c
index 115f755bb7d..3f7ab679429 100644
--- a/src/glx/indirect_vertex_array.c
+++ b/src/glx/indirect_vertex_array.c
@@ -115,14 +115,10 @@ __glXFreeVertexArrayState(struct glx_context * gc)
struct array_state_vector *arrays = state->array_state;
if (arrays) {
- if (arrays->stack) {
- free(arrays->stack);
- arrays->stack = NULL;
- }
- if (arrays->arrays) {
- free(arrays->arrays);
- arrays->arrays = NULL;
- }
+ free(arrays->stack);
+ arrays->stack = NULL;
+ free(arrays->arrays);
+ arrays->arrays = NULL;
free(arrays);
state->array_state = NULL;
}
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c
index 92974840050..72483a42a5c 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -989,8 +989,7 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
XML_ParserFree (p);
}
- if (filenames[1])
- free(filenames[1]);
+ free(filenames[1]);
}
void driDestroyOptionInfo (driOptionCache *info) {
@@ -1000,8 +999,7 @@ void driDestroyOptionInfo (driOptionCache *info) {
for (i = 0; i < size; ++i) {
if (info->info[i].name) {
free(info->info[i].name);
- if (info->info[i].ranges)
- free(info->info[i].ranges);
+ free(info->info[i].ranges);
}
}
free(info->info);
@@ -1009,8 +1007,7 @@ void driDestroyOptionInfo (driOptionCache *info) {
}
void driDestroyOptionCache (driOptionCache *cache) {
- if (cache->values)
- free(cache->values);
+ free(cache->values);
}
GLboolean driCheckOption (const driOptionCache *cache, const char *name,
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index df8ac7fb301..e1173fe79a2 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -717,10 +717,8 @@ intel_buffer_object_purgeable(struct gl_context * ctx,
return intel_buffer_purgeable(intel_obj->buffer);
if (option == GL_RELEASED_APPLE) {
- if (intel_obj->sys_buffer != NULL) {
- free(intel_obj->sys_buffer);
- intel_obj->sys_buffer = NULL;
- }
+ free(intel_obj->sys_buffer);
+ intel_obj->sys_buffer = NULL;
return GL_RELEASED_APPLE;
} else {
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 5d938798d9f..6820f9804e1 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -150,10 +150,8 @@ intel_free_texture_image_buffer(struct gl_context * ctx,
intelImage->base.Buffer = NULL;
}
- if (intelImage->base.ImageOffsets) {
- free(intelImage->base.ImageOffsets);
- intelImage->base.ImageOffsets = NULL;
- }
+ free(intelImage->base.ImageOffsets);
+ intelImage->base.ImageOffsets = NULL;
}
/**
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 6a56891ba41..67f588c00e6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -203,8 +203,7 @@ static void radeon_destroy_atom_list(radeonContextPtr radeon)
foreach(atom, &radeon->hw.atomlist) {
free(atom->cmd);
- if (atom->lastcmd)
- free(atom->lastcmd);
+ free(atom->lastcmd);
}
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 223a9872cc9..007e06157e9 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -148,10 +148,8 @@ void radeonFreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_imag
image->base.Buffer = NULL;
}
- if (image->base.ImageOffsets) {
- free(image->base.ImageOffsets);
- image->base.ImageOffsets = NULL;
- }
+ free(image->base.ImageOffsets);
+ image->base.ImageOffsets = NULL;
}
/* Set Data pointer and additional data for mapped texture image */
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index e6e4d7649aa..69c2de189b5 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -779,9 +779,7 @@ choose_x_overlay_visual( Display *dpy, int scr,
if (deepvis==NULL || vislist->depth > deepest) {
/* YES! found a satisfactory visual */
- if (deepvis) {
- free(deepvis);
- }
+ free(deepvis);
deepest = vislist->depth;
deepvis = vislist;
/* DEBUG tt = ov->transparent_type;*/
diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c
index 080e8ee2284..63608a33fb6 100644
--- a/src/mesa/main/atifragshader.c
+++ b/src/mesa/main/atifragshader.c
@@ -83,10 +83,8 @@ _mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_sha
{
GLuint i;
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
- if (s->Instructions[i])
- free(s->Instructions[i]);
- if (s->SetupInst[i])
- free(s->SetupInst[i]);
+ free(s->Instructions[i]);
+ free(s->SetupInst[i]);
}
free(s);
}
@@ -342,10 +340,8 @@ _mesa_BeginFragmentShaderATI(void)
(or, could use the same mem but would need to reinitialize) */
/* no idea if it's allowed to redefine a shader */
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
- if (ctx->ATIFragmentShader.Current->Instructions[i])
- free(ctx->ATIFragmentShader.Current->Instructions[i]);
- if (ctx->ATIFragmentShader.Current->SetupInst[i])
- free(ctx->ATIFragmentShader.Current->SetupInst[i]);
+ free(ctx->ATIFragmentShader.Current->Instructions[i]);
+ free(ctx->ATIFragmentShader.Current->SetupInst[i]);
}
/* malloc the instructions here - not sure if the best place but its
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 728cc51da4f..0ce3667b616 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -264,8 +264,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx,
{
(void) ctx;
- if (bufObj->Data)
- free(bufObj->Data);
+ free(bufObj->Data);
/* assign strange values here to help w/ debugging */
bufObj->RefCount = -1000;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 0a1fb43f4fa..6b28690ec9f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1158,11 +1158,9 @@ _mesa_free_context_data( struct gl_context *ctx )
_mesa_free_errors_data(ctx);
- if (ctx->Extensions.String)
- free((void *) ctx->Extensions.String);
+ free((void *)ctx->Extensions.String);
- if (ctx->VersionString)
- free(ctx->VersionString);
+ free(ctx->VersionString);
/* unbind the context if it's currently bound */
if (ctx == _mesa_get_current_context()) {
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 2985ad777cf..934a2d05f75 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -218,8 +218,7 @@ _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
void *newBuffer = malloc(newSize);
if (newBuffer && oldBuffer && copySize > 0)
memcpy(newBuffer, oldBuffer, copySize);
- if (oldBuffer)
- free(oldBuffer);
+ free(oldBuffer);
return newBuffer;
}
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index badb96a305a..643ef516f8c 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -703,9 +703,7 @@ shader_source(struct gl_context *ctx, GLuint shader, const GLchar *source)
return;
/* free old shader source string and install new one */
- if (sh->Source) {
- free((void *) sh->Source);
- }
+ free((void *)sh->Source);
sh->Source = source;
sh->CompileStatus = GL_FALSE;
#ifdef DEBUG
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 16800ae5ec6..c7f45c88e72 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -124,8 +124,7 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
static void
_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh)
{
- if (sh->Source)
- free((void *) sh->Source);
+ free((void *)sh->Source);
_mesa_reference_program(ctx, &sh->Program, NULL);
ralloc_free(sh);
}
@@ -333,10 +332,8 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
}
shProg->NumShaders = 0;
- if (shProg->Shaders) {
- free(shProg->Shaders);
- shProg->Shaders = NULL;
- }
+ free(shProg->Shaders);
+ shProg->Shaders = NULL;
/* Transform feedback varying vars */
for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
diff --git a/src/mesa/main/texcompress_cpal.c b/src/mesa/main/texcompress_cpal.c
index 48665212d98..ceeec940376 100644
--- a/src/mesa/main/texcompress_cpal.c
+++ b/src/mesa/main/texcompress_cpal.c
@@ -214,8 +214,7 @@ _mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
_mesa_TexImage2D(target, lvl, info->format, w, h, 0,
info->format, info->type, image);
- if (image)
- free(image);
+ free(image);
/* advance index pointer to point to next src mipmap */
if (info->palette_size == 16)
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 8948bd278ee..92af29ad402 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -1361,9 +1361,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
}
cleanUp:
- if (newSource != NULL) {
- free(newSource);
- }
+ free(newSource);
}
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index 72e51dd0ffe..527bb936ec8 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -84,8 +84,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
return;
}
- if (program->Base.String != NULL)
- free(program->Base.String);
+ free(program->Base.String);
/* Copy the relevant contents of the arb_program struct into the
* fragment_program struct.
@@ -122,8 +121,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
program->UsesKill = state.fragment.UsesKill;
program->UsesDFdy = state.fragment.UsesDFdy;
- if (program->Base.Instructions)
- free(program->Base.Instructions);
+ free(program->Base.Instructions);
program->Base.Instructions = prog.Instructions;
if (program->Base.Parameters)
@@ -179,8 +177,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
return;
}
- if (program->Base.String != NULL)
- free(program->Base.String);
+ free(program->Base.String);
/* Copy the relevant contents of the arb_program struct into the
* vertex_program struct.
@@ -202,8 +199,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
program->IsPositionInvariant = (state.option.PositionInvariant)
? GL_TRUE : GL_FALSE;
- if (program->Base.Instructions)
- free(program->Base.Instructions);
+ free(program->Base.Instructions);
program->Base.Instructions = prog.Instructions;
if (program->Base.Parameters)
diff --git a/src/mesa/program/nvfragparse.c b/src/mesa/program/nvfragparse.c
index ab69a04fcf0..f251d7e6c9a 100644
--- a/src/mesa/program/nvfragparse.c
+++ b/src/mesa/program/nvfragparse.c
@@ -1549,14 +1549,10 @@ _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
/* install the program */
program->Base.Target = target;
- if (program->Base.String) {
- free(program->Base.String);
- }
+ free(program->Base.String);
program->Base.String = programString;
program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- if (program->Base.Instructions) {
- free(program->Base.Instructions);
- }
+ free(program->Base.Instructions);
program->Base.Instructions = newInst;
program->Base.NumInstructions = parseState.numInst;
program->Base.InputsRead = parseState.inputsRead;
diff --git a/src/mesa/program/nvvertparse.c b/src/mesa/program/nvvertparse.c
index b33056a3990..6272c2f7fee 100644
--- a/src/mesa/program/nvvertparse.c
+++ b/src/mesa/program/nvvertparse.c
@@ -1382,14 +1382,10 @@ _mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget,
/* install the program */
program->Base.Target = target;
- if (program->Base.String) {
- free(program->Base.String);
- }
+ free(program->Base.String);
program->Base.String = programString;
program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- if (program->Base.Instructions) {
- free(program->Base.Instructions);
- }
+ free(program->Base.Instructions);
program->Base.Instructions = newInst;
program->Base.InputsRead = parseState.inputsRead;
if (parseState.isPositionInvariant)
diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
index f9a33d4effe..d69d7b2d465 100644
--- a/src/mesa/program/prog_instruction.c
+++ b/src/mesa/program/prog_instruction.c
@@ -127,10 +127,8 @@ _mesa_free_instructions(struct prog_instruction *inst, GLuint count)
{
GLuint i;
for (i = 0; i < count; i++) {
- if (inst[i].Data)
- free(inst[i].Data);
- if (inst[i].Comment)
- free((char *) inst[i].Comment);
+ free(inst[i].Data);
+ free((char *)inst[i].Comment);
}
free(inst);
}
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index 2018fa52071..b9f4d9d572a 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -80,8 +80,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
{
GLuint i;
for (i = 0; i < paramList->NumParameters; i++) {
- if (paramList->Parameters[i].Name)
- free((void *) paramList->Parameters[i].Name);
+ free((void *)paramList->Parameters[i].Name);
}
free(paramList->Parameters);
if (paramList->ParameterValues)
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 7c1d2f7741f..becb77c1d60 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -382,8 +382,7 @@ _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
if (prog == &_mesa_DummyProgram)
return;
- if (prog->String)
- free(prog->String);
+ free(prog->String);
if (prog->Instructions) {
_mesa_free_instructions(prog->Instructions, prog->NumInstructions);
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0f55edc8e45..518b680f02c 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -835,8 +835,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
}
- if (tempSrc)
- free(tempSrc);
+ free(tempSrc);
}
st_texture_image_unmap(st, stImage);
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index d5acaee8312..31a12dade1a 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -829,8 +829,7 @@ _swrast_DestroyContext( struct gl_context *ctx )
}
free( swrast->SpanArrays );
- if (swrast->ZoomedArrays)
- free( swrast->ZoomedArrays );
+ free( swrast->ZoomedArrays );
free( swrast->TexelBuffer );
free(swrast->stencil_temp.buf1);
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 93d2d352922..7665408fd13 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -493,9 +493,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
span.array->ChanType = CHAN_TYPE;
}
- if (convImage) {
- free(convImage);
- }
+ free(convImage);
swrast_render_finish(ctx);
}
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index e468bdb16b0..b1fb57823f4 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -119,10 +119,8 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
bpp = _mesa_get_format_bytes(rb->Format);
/* free old buffer storage */
- if (srb->Buffer) {
- free(srb->Buffer);
- srb->Buffer = NULL;
- }
+ free(srb->Buffer);
+ srb->Buffer = NULL;
srb->RowStride = width * bpp;
@@ -170,10 +168,8 @@ soft_renderbuffer_delete(struct gl_renderbuffer *rb)
{
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
- if (srb->Buffer) {
- free(srb->Buffer);
- srb->Buffer = NULL;
- }
+ free(srb->Buffer);
+ srb->Buffer = NULL;
_mesa_delete_renderbuffer(rb);
}
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index defe669941f..8ae3d5bd0e6 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -144,10 +144,8 @@ _swrast_free_texture_image_buffer(struct gl_context *ctx,
swImage->Buffer = NULL;
}
- if (swImage->ImageOffsets) {
- free(swImage->ImageOffsets);
- swImage->ImageOffsets = NULL;
- }
+ free(swImage->ImageOffsets);
+ swImage->ImageOffsets = NULL;
}
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 79fbf357d1a..8ba67f3c009 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -589,8 +589,8 @@ static void free_texgen_data( struct tnl_pipeline_stage *stage )
_mesa_vector4f_free( &store->texcoord[i] );
- if (store->tmp_f) free( store->tmp_f );
- if (store->tmp_m) free( store->tmp_m );
+ free( store->tmp_f );
+ free( store->tmp_m );
free( store );
stage->privatePtr = NULL;
}
diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c
index 0797b5bc84c..6f9d61c9bbc 100644
--- a/src/mesa/vbo/vbo_primitive_restart.c
+++ b/src/mesa/vbo/vbo_primitive_restart.c
@@ -226,8 +226,6 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
}
}
- if (sub_prims) {
- free(sub_prims);
- }
+ free(sub_prims);
}
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index 0813f1ccd12..d0bf6c59dc3 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -242,11 +242,9 @@ void vbo_rebase_prims( struct gl_context *ctx,
ctx->Array._DrawArrays = saved_arrays;
ctx->NewDriverState |= ctx->DriverFlags.NewArray;
- if (tmp_indices)
- free(tmp_indices);
+ free(tmp_indices);
- if (tmp_prims)
- free(tmp_prims);
+ free(tmp_prims);
}
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 636aa1fdb7e..f7936610c1c 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1577,10 +1577,8 @@ vbo_destroy_vertex_list(struct gl_context *ctx, void *data)
if (--node->prim_store->refcount == 0)
free(node->prim_store);
- if (node->current_data) {
- free(node->current_data);
- node->current_data = NULL;
- }
+ free(node->current_data);
+ node->current_data = NULL;
}