summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/glx
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/gallium/state_trackers/glx
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/gallium/state_trackers/glx')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c6
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c6
2 files changed, 4 insertions, 8 deletions
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;
}