summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
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/drivers
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/drivers')
-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
6 files changed, 11 insertions, 23 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;*/