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/egl/drivers | |
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/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 3 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 3 | ||||
-rw-r--r-- | src/egl/drivers/glx/egl_glx.c | 6 |
3 files changed, 4 insertions, 8 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index f2cce747e7a..f99bcad3081 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -611,8 +611,7 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) close(dri2_dpy->fd); if (dri2_dpy->driver) dlclose(dri2_dpy->driver); - if (dri2_dpy->device_name) - free(dri2_dpy->device_name); + free(dri2_dpy->device_name); if (disp->PlatformDisplay == NULL) { switch (disp->Platform) { diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 7486a91ec0c..f7dc89dc992 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -581,8 +581,7 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id) if (authenticate == NULL || !authenticate->authenticated) ret = -1; - if (authenticate) - free(authenticate); + free(authenticate); return ret; } diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index 7181145ae89..8fe19f94c1f 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -655,10 +655,8 @@ GLX_eglTerminate(_EGLDriver *drv, _EGLDisplay *disp) _eglReleaseDisplayResources(drv, disp); _eglCleanupDisplay(disp); - if (GLX_dpy->visuals) - free(GLX_dpy->visuals); - if (GLX_dpy->fbconfigs) - free(GLX_dpy->fbconfigs); + free(GLX_dpy->visuals); + free(GLX_dpy->fbconfigs); if (!disp->PlatformDisplay) XCloseDisplay(GLX_dpy->dpy); |