diff options
author | Matt Turner <[email protected]> | 2012-09-03 20:24:35 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-09-05 22:28:50 -0700 |
commit | 5067506ea6ada5eeae33b1acf1c916e00121c12a (patch) | |
tree | a6b4ff2e3cf5fb6058101aee3b6f1dcd3f382c15 /src/mesa/drivers/dri/intel | |
parent | a9e8054fffc6e3e6a5f108a96c331858c28a5862 (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/dri/intel')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffer_objects.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.c | 6 |
2 files changed, 4 insertions, 8 deletions
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; } /** |