summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
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
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')
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c4
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c9
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c6
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c6
-rw-r--r--src/gallium/state_trackers/vega/shaders_cache.c9
-rw-r--r--src/gallium/state_trackers/xvmc/subpicture.c3
6 files changed, 12 insertions, 25 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);
}
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;
}
diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c
index 29463843bb7..eceae54051e 100644
--- a/src/gallium/state_trackers/vega/shaders_cache.c
+++ b/src/gallium/state_trackers/vega/shaders_cache.c
@@ -238,12 +238,9 @@ combine_shaders(const struct shader_asm_info *shaders[SHADER_STAGES], int num_sh
ureg_destroy(ureg);
- if (temp)
- free(temp);
- if (constant)
- free(constant);
- if (sampler)
- free(sampler);
+ free(temp);
+ free(constant);
+ free(sampler);
return p;
}
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
index f9f646b7496..8e96ce66dc0 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -115,8 +115,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, int xvi
subpictures = XvMCListSubpictureTypes(dpy, port, surface_type_id, &num_subpics);
if (num_subpics < 1) {
- if (subpictures)
- free(subpictures);
+ free(subpictures);
return BadMatch;
}
if (!subpictures)