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/gallium/state_trackers/xvmc/subpicture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gallium/state_trackers/xvmc') diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c index f9f646b..8e96ce6 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) -- cgit v1.1