diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/atifragshader.c | 12 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 3 | ||||
-rw-r--r-- | src/mesa/main/context.c | 6 | ||||
-rw-r--r-- | src/mesa/main/imports.c | 3 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 4 | ||||
-rw-r--r-- | src/mesa/main/shaderobj.c | 9 | ||||
-rw-r--r-- | src/mesa/main/texcompress_cpal.c | 3 | ||||
-rw-r--r-- | src/mesa/main/texcompress_fxt1.c | 4 |
8 files changed, 14 insertions, 30 deletions
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); } |