From 5067506ea6ada5eeae33b1acf1c916e00121c12a Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 3 Sep 2012 20:24:35 -0700 Subject: 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 --- src/mesa/drivers/x11/fakeglx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mesa/drivers/x11/fakeglx.c') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index e6e4d7649aa..69c2de189b5 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -779,9 +779,7 @@ choose_x_overlay_visual( Display *dpy, int scr, if (deepvis==NULL || vislist->depth > deepest) { /* YES! found a satisfactory visual */ - if (deepvis) { - free(deepvis); - } + free(deepvis); deepest = vislist->depth; deepvis = vislist; /* DEBUG tt = ov->transparent_type;*/ -- cgit v1.2.3