summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl
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/egl
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/egl')
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c4
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c9
2 files changed, 4 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index 34be89a1197..b9c51279100 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -217,9 +217,7 @@ __glXFreeDisplayPrivate(XExtData * extension)
priv = (__GLXdisplayPrivate *) extension->private_data;
FreeScreenConfigs(priv);
- if (priv->serverGLXversion)
- free((char *) priv->serverGLXversion);
-
+ free((char *) priv->serverGLXversion);
free((char *) priv);
return 0;
}
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index 47d9a69c7dd..effac0e711d 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -95,10 +95,8 @@ x11_screen_destroy(struct x11_screen *xscr)
{
if (xscr->dri_fd >= 0)
close(xscr->dri_fd);
- if (xscr->dri_driver)
- free(xscr->dri_driver);
- if (xscr->dri_device)
- free(xscr->dri_device);
+ free(xscr->dri_driver);
+ free(xscr->dri_device);
#ifdef GLX_DIRECT_RENDERING
/* xscr->glx_dpy will be destroyed with the X display */
@@ -106,8 +104,7 @@ x11_screen_destroy(struct x11_screen *xscr)
xscr->glx_dpy->xscr = NULL;
#endif
- if (xscr->visuals)
- free(xscr->visuals);
+ free(xscr->visuals);
FREE(xscr);
}