summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-03 20:24:35 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:50 -0700
commit5067506ea6ada5eeae33b1acf1c916e00121c12a (patch)
treea6b4ff2e3cf5fb6058101aee3b6f1dcd3f382c15 /src/mesa
parenta9e8054fffc6e3e6a5f108a96c331858c28a5862 (diff)
Remove useless checks for NULL before freeing
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]>
Diffstat (limited to 'src/mesa')
-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
29 files changed, 53 insertions, 113 deletions
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;
}