[PATCH] Remove more superfluous if(p) checks around free(p)

Mikhail Gusarov dottedmag at dottedmag.net
Sun Jun 6 01:40:58 PDT 2010


This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@

-if(E) { free(E); }
+free(E);

Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 Xext/panoramiX.c                      |    3 +-
 Xext/security.c                       |    2 +-
 Xext/xace.c                           |    2 +-
 Xext/xvmc.c                           |    9 ++----
 Xi/gtmotion.c                         |    3 +-
 Xi/xiproperty.c                       |    9 ++----
 config/dbus.c                         |    6 +---
 config/hal.c                          |   48 +++++++++++----------------------
 dbe/dbe.c                             |   15 ++--------
 dix/colormap.c                        |   12 +++-----
 dix/devices.c                         |   15 +++-------
 dix/dispatch.c                        |    4 +-
 dix/dixfonts.c                        |   14 ++++-----
 dix/dixutils.c                        |    2 +-
 dix/events.c                          |   12 +++-----
 dix/getevents.c                       |    3 +-
 dix/grabs.c                           |    8 +++---
 dix/region.c                          |    3 +-
 exa/exa_mixed.c                       |    3 +-
 glx/glxcmds.c                         |    3 +-
 glx/glxext.c                          |   12 ++++----
 glx/single2.c                         |    6 +---
 glx/xfont.c                           |    4 +--
 hw/dmx/config/dmxparse.c              |    4 +-
 hw/dmx/dmx.h                          |    2 +-
 hw/dmx/dmxinit.c                      |    4 +-
 hw/dmx/dmxstat.c                      |    2 +-
 hw/dmx/glxProxy/glxutil.c             |    4 +--
 hw/dmx/glxProxy/glxvisuals.c          |    3 +-
 hw/dmx/input/dmxbackend.c             |    2 +-
 hw/dmx/input/dmxconsole.c             |    2 +-
 hw/dmx/input/dmxinputinit.c           |   12 ++++----
 hw/dmx/input/lnx-keyboard.c           |    2 +-
 hw/dmx/input/lnx-ms.c                 |    2 +-
 hw/dmx/input/lnx-ps2.c                |    2 +-
 hw/dmx/input/usb-common.c             |    2 +-
 hw/kdrive/fake/fake.c                 |    3 +-
 hw/xfree86/common/xf86AutoConfig.c    |    3 +-
 hw/xfree86/common/xf86Cursor.c        |    8 +++---
 hw/xfree86/common/xf86Helper.c        |    9 ++----
 hw/xfree86/common/xf86Xinput.c        |    6 +---
 hw/xfree86/common/xf86cmap.c          |    2 +-
 hw/xfree86/common/xf86sbusBus.c       |    3 +-
 hw/xfree86/dixmods/extmod/xf86vmode.c |    3 +-
 hw/xfree86/dri/dri.c                  |    8 ++---
 hw/xfree86/loader/loadext.c           |    6 +---
 hw/xfree86/loader/loadmod.c           |   12 +++-----
 hw/xfree86/modes/xf86Crtc.c           |    9 ++----
 hw/xfree86/modes/xf86DiDGA.c          |    3 +-
 hw/xfree86/modes/xf86Rotate.c         |    6 +---
 hw/xfree86/parser/Flags.c             |    3 +-
 hw/xfree86/parser/scan.c              |    6 +---
 hw/xfree86/ramdac/xf86RamDac.c        |    6 +---
 hw/xfree86/vgahw/vgaHW.c              |    3 +-
 hw/xfree86/xaa/xaaCpyArea.c           |    4 +-
 hw/xfree86/xaa/xaaGC.c                |    3 +-
 hw/xfree86/xaa/xaaInit.c              |    6 +---
 hw/xfree86/xaa/xaaLineMisc.c          |    3 +-
 hw/xfree86/xaa/xaaPCache.c            |   18 ++++--------
 hw/xfree86/xaa/xaaTEText.c            |    3 +-
 hw/xnest/Color.c                      |    8 ++---
 hw/xwin/winclipboardxevents.c         |    9 ++----
 hw/xwin/winerror.c                    |    6 +---
 hw/xwin/winprefs.c                    |   12 +++-----
 mi/miarc.c                            |    6 +---
 mi/mibitblt.c                         |   19 +++++--------
 mi/micopy.c                           |    9 ++----
 mi/mifillrct.c                        |    4 +-
 mi/mifpolycon.c                       |    6 ++--
 mi/mipolycon.c                        |    4 +-
 mi/mispans.c                          |   12 +++-----
 randr/rrcrtc.c                        |   36 ++++++++----------------
 randr/rroutput.c                      |   15 +++-------
 randr/rrproperty.c                    |   30 +++++++-------------
 randr/rrscreen.c                      |    3 +-
 randr/rrtransform.c                   |    6 +---
 record/record.c                       |    8 ++---
 record/set.c                          |    2 +-
 render/picture.c                      |    3 +-
 xkb/XKBGAlloc.c                       |    6 +---
 xkb/XKBMAlloc.c                       |    9 ++----
 xkb/maprules.c                        |   28 +++++++++---------
 xkb/xkbInit.c                         |   30 +++++++-------------
 xkb/xkbLEDs.c                         |    4 +-
 84 files changed, 240 insertions(+), 412 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 1cb58b5..27ca01f 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -1276,8 +1276,7 @@ XineramaGetImageData(
 	
     }
 
-    if(ScratchMem)
-	free(ScratchMem);
+    free(ScratchMem);
 
     RegionUninit(&SrcRegion);
     RegionUninit(&GrabRegion);
diff --git a/Xext/security.c b/Xext/security.c
index 12210f8..9ef6d19 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -604,7 +604,7 @@ bailout:
     if (removeAuth)
 	RemoveAuthorization(stuff->nbytesAuthProto, protoname,
 			    authdata_len, pAuthdata);
-    if (pAuth) free(pAuth);
+    free(pAuth);
     return err;
 
 } /* ProcSecurityGenerateAuthorization */
diff --git a/Xext/xace.c b/Xext/xace.c
index abd4690..e10d837 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -323,7 +323,7 @@ XaceCensorImage(
 	     */
 	    memset(pBuf, 0, (int)(widthBytesLine * h));
 	}
-	if (pRects)     free(pRects);
+	free(pRects);
 	if (pScratchGC) FreeScratchGC(pScratchGC);
 	if (pPix)       FreeScratchPixmapHeader(pPix);
     }
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index 982fad1..8fbdfae 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -259,8 +259,7 @@ ProcXvMCCreateContext(ClientPtr client)
       WriteToClient(client, dwords << 2, (char*)data); 
     AddResource(pContext->context_id, XvMCRTContext, pContext);
 
-    if(data)
-	free(data);
+    free(data);
 
     return Success;
 }
@@ -327,8 +326,7 @@ ProcXvMCCreateSurface(ClientPtr client)
       WriteToClient(client, dwords << 2, (char*)data);
     AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
 
-    if(data)
-        free(data);
+    free(data);
 
     pContext->refcnt++;
 
@@ -444,8 +442,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
       WriteToClient(client, dwords << 2, (char*)data);
     AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
 
-    if(data)
-        free(data);
+    free(data);
 
     pContext->refcnt++;
 
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 32d80ee..9132f4f 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -153,8 +153,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
 	}
 	WriteToClient(client, length * 4, (char *)coords);
     }
-    if (coords)
-	free(coords);
+    free(coords);
     return Success;
 }
 
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index b4d939f..c1839aa 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -622,8 +622,7 @@ XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
 static void
 XIDestroyDeviceProperty (XIPropertyPtr prop)
 {
-    if (prop->value.data)
-        free(prop->value.data);
+    free(prop->value.data);
     free(prop);
 }
 
@@ -798,8 +797,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
                                 &new_value, checkonly);
                         if (checkonly && rc != Success)
                         {
-                            if (new_value.data)
-                                free(new_value.data);
+                            free(new_value.data);
                             return (rc);
                         }
                     }
@@ -808,8 +806,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
                 checkonly = !checkonly;
             } while (!checkonly);
         }
-        if (prop_value->data)
-            free(prop_value->data);
+        free(prop_value->data);
         *prop_value = new_value;
     } else if (len == 0)
     {
diff --git a/config/dbus.c b/config/dbus.c
index ee90da0..c4bf7e8 100644
--- a/config/dbus.c
+++ b/config/dbus.c
@@ -184,10 +184,8 @@ unwind:
     while (options) {
         tmpo = options;
         options = options->next;
-        if (tmpo->key)
-            free(tmpo->key);
-        if (tmpo->value)
-            free(tmpo->value);
+        free(tmpo->key);
+        free(tmpo->value);
         free(tmpo);
     }
 
diff --git a/config/hal.c b/config/hal.c
index 15eb177..ecbca2f 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -251,28 +251,23 @@ device_added(LibHalContext *hal_ctx, const char *udi)
                     {
                         if (!strcasecmp(&tmp[3], "layout"))
                         {
-                            if (xkb_opts.layout)
-                                free(xkb_opts.layout);
+                            free(xkb_opts.layout);
                             xkb_opts.layout = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "model"))
                         {
-                            if (xkb_opts.model)
-                                free(xkb_opts.model);
+                            free(xkb_opts.model);
                             xkb_opts.model = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "rules"))
                         {
-                            if (xkb_opts.rules)
-                                free(xkb_opts.rules);
+                            free(xkb_opts.rules);
                             xkb_opts.rules = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "variant"))
                         {
-                            if (xkb_opts.variant)
-                                free(xkb_opts.variant);
+                            free(xkb_opts.variant);
                             xkb_opts.variant = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "options"))
                         {
-                            if (xkb_opts.options)
-                                free(xkb_opts.options);
+                            free(xkb_opts.options);
                             xkb_opts.options = strdup(tmp_val);
                         }
                     } else
@@ -289,8 +284,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
                         (!strcasecmp(&tmp[3], "options")) &&
                         (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
                     {
-                        if (xkb_opts.options)
-                            free(xkb_opts.options);
+                        free(xkb_opts.options);
                         xkb_opts.options = strdup(tmp_val);
                     }
                 }
@@ -366,22 +360,17 @@ device_added(LibHalContext *hal_ctx, const char *udi)
     }
 
     for (; dev; dev = dev->next){
-        if (dev->config_info)
-            free(dev->config_info);
+        free(dev->config_info);
         dev->config_info = strdup(config_info);
     }
 
 unwind:
     if (set)
         libhal_free_property_set(set);
-    if (path)
-        free(path);
-    if (driver)
-        free(driver);
-    if (name)
-        free(name);
-    if (config_info)
-        free(config_info);
+    free(path);
+    free(driver);
+    free(name);
+    free(config_info);
     while (!dev && (tmpo = options)) {
         options = tmpo->next;
         free(tmpo->key);
@@ -401,16 +390,11 @@ unwind:
         free(attrs.tags);
     }
 
-    if (xkb_opts.layout)
-        free(xkb_opts.layout);
-    if (xkb_opts.rules)
-        free(xkb_opts.rules);
-    if (xkb_opts.model)
-        free(xkb_opts.model);
-    if (xkb_opts.variant)
-        free(xkb_opts.variant);
-    if (xkb_opts.options)
-        free(xkb_opts.options);
+    free(xkb_opts.layout);
+    free(xkb_opts.rules);
+    free(xkb_opts.model);
+    free(xkb_opts.variant);
+    free(xkb_opts.options);
 
     dbus_error_free(&error);
 
diff --git a/dbe/dbe.c b/dbe/dbe.c
index ef4b596..b4b7466 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -693,10 +693,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
     if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count *
                         sizeof(XdbeScreenVisualInfo))))
     {
-        if (pDrawables)
-        {
-            free(pDrawables);
-        }
+        free(pDrawables);
 
         return(BadAlloc);
     }
@@ -722,10 +719,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
             }
 
             /* Free pDrawables if we needed to allocate it above. */
-            if (pDrawables)
-            {
-                free(pDrawables);
-            }
+            free(pDrawables);
 
             return (rc == Success) ? BadAlloc : rc;
         }
@@ -803,10 +797,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
     }
     free(pScrVisInfo);
 
-    if (pDrawables)
-    {
-        free(pDrawables);
-    }
+    free(pDrawables);
 
     return Success;
 
diff --git a/dix/colormap.c b/dix/colormap.c
index d530830..ae90690 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1639,8 +1639,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes,
 	pcr->client = client;
 	if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
 	    ok = BadAlloc;
-    } else if (pcr)
-	free(pcr);
+    } else free(pcr);
 
     return (ok);
 }
@@ -1730,8 +1729,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors,
 	pcr->client = client;
 	if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
 	    ok = BadAlloc;
-    } else if (pcr)
-	free(pcr);
+    } else free(pcr);
 
     return (ok);
 }
@@ -1764,9 +1762,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
     ppixBlue = malloc(npixB * sizeof(Pixel));
     if (!ppixRed || !ppixGreen || !ppixBlue)
     {
-	if (ppixBlue) free(ppixBlue);
-	if (ppixGreen) free(ppixGreen);
-	if (ppixRed) free(ppixRed);
+	free(ppixBlue);
+	free(ppixGreen);
+	free(ppixRed);
 	return(BadAlloc);
     }
 
diff --git a/dix/devices.c b/dix/devices.c
index 427264d..8f9c8ff 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -740,8 +740,7 @@ FreeDeviceClass(int type, pointer *class)
         case ButtonClass:
             {
                 ButtonClassPtr *b = (ButtonClassPtr*)class;
-                if ((*b)->xkb_acts)
-                    free((*b)->xkb_acts);
+                free((*b)->xkb_acts);
                 free((*b));
                 break;
             }
@@ -749,8 +748,7 @@ FreeDeviceClass(int type, pointer *class)
             {
                 ValuatorClassPtr *v = (ValuatorClassPtr*)class;
 
-                if ((*v)->motion)
-                    free((*v)->motion);
+                free((*v)->motion);
                 free((*v));
                 break;
             }
@@ -1465,10 +1463,8 @@ InitStringFeedbackClassDeviceStruct (
     feedc->ctrl.symbols_displayed = malloc(sizeof (KeySym) * max_symbols);
     if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
     {
-	if (feedc->ctrl.symbols_supported)
-	    free(feedc->ctrl.symbols_supported);
-	if (feedc->ctrl.symbols_displayed)
-	    free(feedc->ctrl.symbols_displayed);
+	free(feedc->ctrl.symbols_supported);
+	free(feedc->ctrl.symbols_displayed);
 	free(feedc);
 	return FALSE;
     }
@@ -2283,8 +2279,7 @@ ProcGetMotionEvents(ClientPtr client)
 	WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
 				 (char *)coords);
     }
-    if (coords)
-	free(coords);
+    free(coords);
     return Success;
 }
 
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 79bdb55..44164f2 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -2837,7 +2837,7 @@ ProcQueryColors(ClientPtr client)
             return(BadAlloc);
 	if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) )
 	{
-	    if (prgbs) free(prgbs);
+	    free(prgbs);
 	    return rc;
 	}
 	memset(&qcr, 0, sizeof(xQueryColorsReply));
@@ -2851,7 +2851,7 @@ ProcQueryColors(ClientPtr client)
 	    client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
 	    WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
 	}
-	if (prgbs) free(prgbs);
+	free(prgbs);
 	return Success;
 	
     }
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 7635635..fd5da1b 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -677,7 +677,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		    return TRUE;
 		}
 		if (err == FontNameAlias) {
-		    if (resolved) free(resolved);
+		    free(resolved);
 		    resolved = malloc(resolvedlen + 1);
 		    if (resolved)
 			memmove(resolved, tmpname, resolvedlen + 1);
@@ -731,8 +731,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		{
 		    c->saved = c->current;
 		    c->haveSaved = TRUE;
-		    if (c->savedName)
-			free(c->savedName);
+		    free(c->savedName);
 		    c->savedName = malloc(namelen + 1);
 		    if (c->savedName)
 			memmove(c->savedName, name, namelen + 1);
@@ -828,10 +827,10 @@ bail:
     for (i = 0; i < c->num_fpes; i++)
 	FreeFPE(c->fpe_list[i]);
     free(c->fpe_list);
-    if (c->savedName) free(c->savedName);
+    free(c->savedName);
     FreeFontNames(names);
     free(c);
-    if (resolved) free(resolved);
+    free(resolved);
     return TRUE;
 }
 
@@ -994,8 +993,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
 		c->saved = c->current;
 		c->haveSaved = TRUE;
 		c->savedNumFonts = numFonts;
-		if (c->savedName)
-		  free(c->savedName);
+		free(c->savedName);
 		c->savedName = malloc(namelen + 1);
 		if (c->savedName)
 		  memmove(c->savedName, name, namelen + 1);
@@ -1106,7 +1104,7 @@ bail:
 	FreeFPE(c->fpe_list[i]);
     free(c->reply);
     free(c->fpe_list);
-    if (c->savedName) free(c->savedName);
+    free(c->savedName);
     free(c);
     return TRUE;
 }
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 51dbd14..cb1c97c 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -893,7 +893,7 @@ InitCallbackManager(void)
     {
 	DeleteCallbackList(listsToCleanup[i]);
     }
-    if (listsToCleanup) free(listsToCleanup);
+    free(listsToCleanup);
 
     numCallbackListsToCleanup = 0;
     listsToCleanup = NULL;
diff --git a/dix/events.c b/dix/events.c
index 1be212f..2dc0e98 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3793,10 +3793,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
     }
 
 unwind:
-    if (xE)
-        free(xE);
-    if (xi2)
-        free(xi2);
+    free(xE);
+    free(xi2);
     return;
 }
 
@@ -3976,10 +3974,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 	}
     }
 
-    if (xi)
-        free(xi);
-    if (xi2)
-        free(xi2);
+    free(xi);
+    free(xi2);
 }
 
 /* This function is used to set the key pressed or key released state -
diff --git a/dix/getevents.c b/dix/getevents.c
index 3892f6f..f9d65e9 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -327,8 +327,7 @@ void
 AllocateMotionHistory(DeviceIntPtr pDev)
 {
     int size;
-    if (pDev->valuator->motion)
-        free(pDev->valuator->motion);
+    free(pDev->valuator->motion);
 
     if (pDev->valuator->numMotionEvents < 1)
         return;
diff --git a/dix/grabs.c b/dix/grabs.c
index 2931631..f850e3d 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -441,10 +441,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
     details = malloc(i * sizeof(Mask *));
     if (!deletes || !adds || !updates || !details)
     {
-	if (details) free(details);
-	if (updates) free(updates);
-	if (adds) free(adds);
-	if (deletes) free(deletes);
+	free(details);
+	free(updates);
+	free(adds);
+	free(deletes);
 	return FALSE;
     }
 
diff --git a/dix/region.c b/dix/region.c
index 911fe16..a77d17b 100644
--- a/dix/region.c
+++ b/dix/region.c
@@ -762,8 +762,7 @@ RegionOp(
 	AppendRegions(newReg, r2BandEnd, r2End);
     }
 
-    if (oldData)
-	free(oldData);
+    free(oldData);
 
     if (!(numRects = newReg->data->numRects))
     {
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 89cb137..7fa771d 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -257,8 +257,7 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
 	pExaPixmap->driverPriv = NULL;
 
 	if (pExaPixmap->pDamage) {
-	    if (pExaPixmap->sys_ptr)
-		free(pExaPixmap->sys_ptr);
+	    free(pExaPixmap->sys_ptr);
 	    pExaPixmap->sys_ptr = NULL;
 	    pExaPixmap->pDamage = NULL;
 	}
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 49201d4..9e5b213 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2431,8 +2431,7 @@ int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
    
     cl->GLClientmajorVersion = req->major;
     cl->GLClientminorVersion = req->minor;
-    if (cl->GLClientextensions)
-	free(cl->GLClientextensions);
+    free(cl->GLClientextensions);
     buf = (const char *)(req+1);
     cl->GLClientextensions = strdup(buf);
 
diff --git a/glx/glxext.c b/glx/glxext.c
index 4d02b47..e203156 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -205,8 +205,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
 {
     if (cx->idExists || cx->isCurrent) return GL_FALSE;
     
-    if (cx->feedbackBuf) free(cx->feedbackBuf);
-    if (cx->selectBuf) free(cx->selectBuf);
+    free(cx->feedbackBuf);
+    free(cx->selectBuf);
     if (cx == __glXLastContext) {
 	__glXFlushContextCache();
     }
@@ -323,10 +323,10 @@ glxClientCallback (CallbackListPtr	*list,
 	    }
 	}
 
-	if (cl->returnBuf) free(cl->returnBuf);
-	if (cl->largeCmdBuf) free(cl->largeCmdBuf);
-	if (cl->currentContexts) free(cl->currentContexts);
-	if (cl->GLClientextensions) free(cl->GLClientextensions);
+	free(cl->returnBuf);
+	free(cl->largeCmdBuf);
+	free(cl->currentContexts);
+	free(cl->GLClientextensions);
 	break;
 
     default:
diff --git a/glx/single2.c b/glx/single2.c
index 0700626..56ad86d 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -272,10 +272,8 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
 	s2 = sext_string;
    }
    if (!combo_string || !s1) {
-	if (combo_string)
-	    free(combo_string);
-	if (s1)
-	    free(s1);
+	free(combo_string);
+	free(s1);
 	return NULL;
    }
    combo_string[0] = '\0';
diff --git a/glx/xfont.c b/glx/xfont.c
index f0b5644..b4081cf 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -97,9 +97,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
 				  pci->metrics.characterWidth, 0, 
 				  allocbuf ? allocbuf : buf) );
 
-    if (allocbuf) {
-	free(allocbuf);
-    }
+    free(allocbuf);
     return Success;
 #undef __GL_CHAR_BUF_SIZE
 }
diff --git a/hw/dmx/config/dmxparse.c b/hw/dmx/config/dmxparse.c
index 28a1835..35f1c21 100644
--- a/hw/dmx/config/dmxparse.c
+++ b/hw/dmx/config/dmxparse.c
@@ -98,7 +98,7 @@ const char *dmxConfigCopyString(const char *string, int length)
 
 void dmxConfigFree(void *area)
 {
-    if (area) free(area);
+    free(area);
 }
 
 DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
@@ -370,7 +370,7 @@ DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
 void dmxConfigFreeOption(DMXConfigOptionPtr p)
 {
     if (!p) return;
-    if (p->string) free(p->string);
+    free(p->string);
     dmxConfigFreeToken(p->start);
     dmxConfigFreeString(p->option);
     dmxConfigFreeToken(p->end);
diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h
index 4532960..bf4b92c 100644
--- a/hw/dmx/dmx.h
+++ b/hw/dmx/dmx.h
@@ -351,7 +351,7 @@ do {									\
         
 #define MAXSCREENSFREE(o)                                               \
     do {                                                                \
-        if (o) free(o);                                                \
+        free(o);                                                \
         o = NULL;                                                       \
     } while (0)
 
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 8a03c65..7cd50da 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -606,8 +606,8 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
             dmxScreens[i].stat = NULL;
         }
         for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
-        if (dmxScreens) free(dmxScreens);
-        if (dmxInputs)  free(dmxInputs);
+        free(dmxScreens);
+        free(dmxInputs);
         dmxScreens    = NULL;
         dmxInputs     = NULL;
         dmxNumScreens = 0;
diff --git a/hw/dmx/dmxstat.c b/hw/dmx/dmxstat.c
index 41b0eb2..c3f1d3b 100644
--- a/hw/dmx/dmxstat.c
+++ b/hw/dmx/dmxstat.c
@@ -122,7 +122,7 @@ DMXStatInfo *dmxStatAlloc(void)
 /** Free the memory used by a \a DMXStatInfo structure. */
 void dmxStatFree(DMXStatInfo *pt)
 {
-    if (pt) free(pt);
+    free(pt);
 }
 
 static void dmxStatValue(DMXStatAvg *data, unsigned long value)
diff --git a/hw/dmx/glxProxy/glxutil.c b/hw/dmx/glxProxy/glxutil.c
index cfd0269..18fd43a 100644
--- a/hw/dmx/glxProxy/glxutil.c
+++ b/hw/dmx/glxProxy/glxutil.c
@@ -105,7 +105,5 @@ __glXRealloc(void *addr, size_t newSize)
 void
 __glXFree(void *addr)
 {
-    if (addr) {
-	free(addr);
-    }
+    free(addr);
 }
diff --git a/hw/dmx/glxProxy/glxvisuals.c b/hw/dmx/glxProxy/glxvisuals.c
index 58151b7..4c64db2 100644
--- a/hw/dmx/glxProxy/glxvisuals.c
+++ b/hw/dmx/glxProxy/glxvisuals.c
@@ -531,8 +531,7 @@ Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
     __glXFree(pNewVisualConfigs);
 
     /* Free the private list created by DDX HW driver */
-    if (visualPrivates)
-        free(visualPrivates);
+    free(visualPrivates);
     visualPrivates = NULL;
 
     return TRUE;
diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c
index 55615cf..e917a5c 100644
--- a/hw/dmx/input/dmxbackend.c
+++ b/hw/dmx/input/dmxbackend.c
@@ -114,7 +114,7 @@ pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice)
  * #dmxBackendCreatePrivate. */
 void dmxBackendDestroyPrivate(pointer private)
 {
-    if (private) free(private);
+    free(private);
 }
 
 static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure)
diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c
index 80df064..7ec209d 100644
--- a/hw/dmx/input/dmxconsole.c
+++ b/hw/dmx/input/dmxconsole.c
@@ -148,7 +148,7 @@ pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
 /** If \a private is non-NULL, free its associated memory. */
 void dmxConsoleDestroyPrivate(pointer private)
 {
-    if (private) free(private);
+    free(private);
 }
 
 static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect)
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 020e21a..83a2abb 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -1084,9 +1084,9 @@ static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
     if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
         dmxLocalCoreKeyboard = NULL;
     if (local->destroy_private) local->destroy_private(local->private);
-    if (local->history)         free(local->history);
-    if (local->valuators)       free(local->valuators);
-    if (local->deviceName)      free(local->deviceName);
+    free(local->history);
+    free(local->valuators);
+    free(local->deviceName);
     local->private    = NULL;
     local->history    = NULL;
     local->deviceName = NULL;
@@ -1100,9 +1100,9 @@ void dmxInputFree(DMXInputInfo *dmxInput)
     
     if (!dmxInput) return;
 
-    if (dmxInput->keycodes) free(dmxInput->keycodes);
-    if (dmxInput->symbols)  free(dmxInput->symbols);
-    if (dmxInput->geometry) free(dmxInput->geometry);
+    free(dmxInput->keycodes);
+    free(dmxInput->symbols);
+    free(dmxInput->geometry);
 
     for (i = 0; i < dmxInput->numDevs; i++) {
         dmxInputFreeLocal(dmxInput->devs[i]);
diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c
index 050c80e..5bfb881 100644
--- a/hw/dmx/input/lnx-keyboard.c
+++ b/hw/dmx/input/lnx-keyboard.c
@@ -368,7 +368,7 @@ pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
 /** Destroy a private structure. */
 void kbdLinuxDestroyPrivate(pointer priv)
 {
-    if (priv) free(priv);
+    free(priv);
 }
 
 /** Ring the bell.
diff --git a/hw/dmx/input/lnx-ms.c b/hw/dmx/input/lnx-ms.c
index 549df46..ee18707 100644
--- a/hw/dmx/input/lnx-ms.c
+++ b/hw/dmx/input/lnx-ms.c
@@ -301,7 +301,7 @@ pointer msLinuxCreatePrivate(DeviceIntPtr pMouse)
 /** Destroy a private structure. */
 void msLinuxDestroyPrivate(pointer priv)
 {
-    if (priv) free(priv);
+    free(priv);
 }
 
 /** Fill the \a info structure with information needed to initialize \a
diff --git a/hw/dmx/input/lnx-ps2.c b/hw/dmx/input/lnx-ps2.c
index 70918ee..3a220cf 100644
--- a/hw/dmx/input/lnx-ps2.c
+++ b/hw/dmx/input/lnx-ps2.c
@@ -269,7 +269,7 @@ pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
 /** Destroy a private structure. */
 void ps2LinuxDestroyPrivate(pointer priv)
 {
-    if (priv) free(priv);
+    free(priv);
 }
 
 /** Fill the \a info structure with information needed to initialize \a
diff --git a/hw/dmx/input/usb-common.c b/hw/dmx/input/usb-common.c
index 95c00b8..25479ae 100644
--- a/hw/dmx/input/usb-common.c
+++ b/hw/dmx/input/usb-common.c
@@ -377,5 +377,5 @@ pointer usbCreatePrivate(DeviceIntPtr pDevice)
 /** Destroy a private structure. */
 void usbDestroyPrivate(pointer priv)
 {
-    if (priv) free(priv);
+    free(priv);
 }
diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c
index 1cf0f2e..b8306db 100644
--- a/hw/kdrive/fake/fake.c
+++ b/hw/kdrive/fake/fake.c
@@ -168,8 +168,7 @@ fakeMapFramebuffer (KdScreenInfo *screen)
     KdSetPointerMatrix (&m);
     
     priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
-    if (priv->base)
-	free (priv->base);
+    free(priv->base);
     priv->base = malloc (priv->bytes_per_line * screen->height);
     
     if (scrpriv->shadow)
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 5b236af..167bc78 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -120,8 +120,7 @@ FreeList(const char ***list, int *lines)
     int i;
 
     for (i = 0; i < *lines; i++) {
-	if ((*list)[i])
-	    free((*list)[i]);
+	free((*list)[i]);
     }
     free(*list);
     *list = NULL;
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index f6c5633..0d27fd5 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -848,10 +848,10 @@ xf86ReconfigureLayout(void)
     for (i = 0; i < MAXSCREENS; i++) {
 	xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
 	/* we don't have to zero these, xf86InitOrigins() takes care of that */
-	if (sl->left) free(sl->left);
-	if (sl->right) free(sl->right);
-	if (sl->up) free(sl->up);
-	if (sl->down) free(sl->down);
+	free(sl->left);
+	free(sl->right);
+	free(sl->up);
+	free(sl->down);
     }
 
     xf86InitOrigins();
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index ac1f283..394fb06 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -234,8 +234,7 @@ xf86DeleteScreen(int scrnIndex, int flags)
     if (pScrn->drv)
 	pScrn->drv->refCount--;
 
-    if (pScrn->privates)
-	free(pScrn->privates);
+    free(pScrn->privates);
 
     xf86ClearEntityListForScreen(scrnIndex);
 
@@ -327,8 +326,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
     /* This should *really* be handled in drv->UnInit(dev) call instead, but
      * if the driver forgets about it make sure we free it or at least crash
      * with flying colors */
-    if (pInp->private)
-	free(pInp->private);
+    free(pInp->private);
 
     FreeInputAttributes(pInp->attrs);
 
@@ -2017,8 +2015,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
        */
       pNewProp->next = NULL;
     } else {
-      if (pNewProp->name)
-	free(pNewProp->name);
+      free(pNewProp->name);
       existing = TRUE;
     }
 
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index e12b7d9..d4afd16 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -844,10 +844,8 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
 unwind:
     if (is_auto && !xf86Info.autoAddDevices)
         xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
-    if(idev->driver)
-        free(idev->driver);
-    if(idev->identifier)
-        free(idev->identifier);
+    free(idev->driver);
+    free(idev->identifier);
     xf86optionListFree(idev->commonOptions);
     free(idev);
     return rval;
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index f26c22c..d2a8f12 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -327,7 +327,7 @@ CMapDestroyColormap (ColormapPtr cmap)
     CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
 
     if(pColPriv) {
-	if(pColPriv->colors) free(pColPriv->colors);
+	free(pColPriv->colors);
 	free(pColPriv);
     }
    
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index ea8c3e1..30a4202 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -478,8 +478,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
 	    instances[i].claimed = TRUE;
 	    instances[i].dev = dev;
 	}
-	if (promPath)
-	    free(promPath);
+	free(promPath);
     }
 
     DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index b02fdaf..3631369 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1102,8 +1102,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
     status = VidModeCheckModeForDriver(stuff->screen, modetmp);
 
 status_reply:
-    if(modetmp)
-      free(modetmp);
+    free(modetmp);
 
     rep.type = X_Reply;
     rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index db4cd7b..61bbe9a 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -578,10 +578,8 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 	      drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) {
 	    DRIDrvMsg(pScreen->myNum, X_ERROR,
 		      "[drm] failed to setup DRM signal handler\n");
-	    if (pDRIPriv->hiddenContextStore)
-		free(pDRIPriv->hiddenContextStore);
-	    if (pDRIPriv->partial3DContextStore)
-		free(pDRIPriv->partial3DContextStore);
+	    free(pDRIPriv->hiddenContextStore);
+	    free(pDRIPriv->partial3DContextStore);
 	    DRIDestroyContextPriv(pDRIContextPriv);
 	    return FALSE;
 	} else {
@@ -1618,7 +1616,7 @@ DRICreateInfoRec(void)
 void
 DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
 {
-    if (DRIInfo->busIdString) free(DRIInfo->busIdString);
+    free(DRIInfo->busIdString);
     free((char*)DRIInfo);
 }
 
diff --git a/hw/xfree86/loader/loadext.c b/hw/xfree86/loader/loadext.c
index 39a92c8..8ac50a6 100644
--- a/hw/xfree86/loader/loadext.c
+++ b/hw/xfree86/loader/loadext.c
@@ -378,10 +378,8 @@ tsort(void)
 	if (n == NULL)
 	    ErrorF("tsort: internal error -- could not find cycle");
     }
-    if (cycle_buf)
-	free(cycle_buf);
-    if (longest_cycle)
-	free(longest_cycle);
+    free(cycle_buf);
+    free(longest_cycle);
     if (graph)
 	free_nodes(graph);
 }
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index bff867c..ae74164 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -315,16 +315,14 @@ InitSubdirs(const char **subdirlist)
 		if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
 		    strstr(*s, "..")) {
 		    xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
-		    if (tmp_subdirlist)
-			free(tmp_subdirlist);
+		    free(tmp_subdirlist);
 		    return NULL;
 		}
 	    }
 	}
 	subdirs = malloc((i * 2 + 1) * sizeof(char *));
 	if (!subdirs) {
-	    if (tmp_subdirlist)
-		free(tmp_subdirlist);
+	    free(tmp_subdirlist);
 	    return NULL;
 	}
 	i = 0;
@@ -348,8 +346,7 @@ InitSubdirs(const char **subdirlist)
 		while (--i >= 0)
 		    free(subdirs[i]);
 		free(subdirs);
-		if (tmp_subdirlist)
-		    free(tmp_subdirlist);
+		free(tmp_subdirlist);
 		return NULL;
 	    }
 	    /* tack on the OS name */
@@ -367,8 +364,7 @@ InitSubdirs(const char **subdirlist)
 	}
 	subdirs[i] = NULL;
     }
-    if (tmp_subdirlist)
-	free(tmp_subdirlist);
+    free(tmp_subdirlist);
     return (const char **)subdirs;
 }
 
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 60003d5..304d503 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -157,8 +157,7 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
 	    xf86_config->num_crtc--;
 	    break;
 	}
-    if (crtc->params)
-	free(crtc->params);
+    free(crtc->params);
     free(crtc->gamma_red);
     free(crtc);
 }
@@ -382,8 +381,7 @@ done:
 	crtc->transformPresent = saved_transform_present;
     }
 
-    if (adjusted_mode->name)
-	    free(adjusted_mode->name);
+    free(adjusted_mode->name);
     free(adjusted_mode);
 
     if (didLock)
@@ -482,8 +480,7 @@ xf86OutputSetMonitor (xf86OutputPtr output)
     if (!output->name)
 	return;
 
-    if (output->options)
-	free(output->options);
+    free(output->options);
 
     output->options = xnfalloc (sizeof (xf86OutputOptions));
     memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index a4cf4f0..ca419ec 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -103,8 +103,7 @@ xf86_dga_get_modes (ScreenPtr pScreen)
 	if (display_mode == scrn->modes)
 	    break;
     }
-    if (xf86_config->dga_modes)
-	free(xf86_config->dga_modes);
+    free(xf86_config->dga_modes);
     xf86_config->dga_nmode = num;
     xf86_config->dga_modes = modes;
     return TRUE;
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 4cc99ad..fdc38c5 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -405,8 +405,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
 	 */
 	xf86RotateDestroy (crtc);
 	crtc->transform_in_use = FALSE;
-	if (new_params)
-	    free(new_params);
+	free(new_params);
 	new_params = NULL;
 	new_nparams = 0;
 	new_filter = NULL;
@@ -506,8 +505,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
     crtc->crtc_to_framebuffer = crtc_to_fb;
     crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
     crtc->f_framebuffer_to_crtc = f_fb_to_crtc;
-    if (crtc->params)
-	free(crtc->params);
+    free(crtc->params);
     crtc->params = new_params;
     crtc->nparams = new_nparams;
     crtc->filter = new_filter;
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index 699f15c..f4fea28 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -451,8 +451,7 @@ xf86parseOption(XF86OptionPtr head)
 
 	if ((token = xf86getSubToken(&comment)) != STRING) {
 		xf86parseError(BAD_OPTION_MSG, NULL);
-		if (comment)
-			free(comment);
+		free(comment);
 		return (head);
 	}
 
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 52e80a9..05fbc89 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -923,8 +923,7 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
 		if (!found) {
 			free(dirpath);
 			dirpath = NULL;
-			if (list)
-				free(list);
+			free(list);
 		}
 	}
 
@@ -1088,8 +1087,7 @@ xf86validationError (char *format,...)
 void
 xf86setSection (char *section)
 {
-	if (configSection)
-		free(configSection);
+	free(configSection);
 	configSection = malloc(strlen (section) + 1);
 	strcpy (configSection, section);
 }
diff --git a/hw/xfree86/ramdac/xf86RamDac.c b/hw/xfree86/ramdac/xf86RamDac.c
index 0015b76..f4d1274 100644
--- a/hw/xfree86/ramdac/xf86RamDac.c
+++ b/hw/xfree86/ramdac/xf86RamDac.c
@@ -132,12 +132,10 @@ RamDacFreeRec(ScrnInfoPtr pScrn)
     ramdacScrPtr = ((RamDacScreenRecPtr)
 				(pScrn)->privates[RamDacGetScreenIndex()].ptr);
     
-    if (ramdacHWPtr)
-	free(ramdacHWPtr);
+    free(ramdacHWPtr);
     ramdacHWPtr = NULL;
 
-    if (ramdacScrPtr)
-	free(ramdacScrPtr);
+    free(ramdacScrPtr);
     ramdacScrPtr = NULL;
 }
 
diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c
index 3ae2dfa..b6832c3 100644
--- a/hw/xfree86/vgahw/vgaHW.c
+++ b/hw/xfree86/vgahw/vgaHW.c
@@ -1479,8 +1479,7 @@ vgaHWGetHWRecPrivate(void)
 static void
 vgaHWFreeRegs(vgaRegPtr regp)
 {
-    if (regp->CRTC)
-        free(regp->CRTC);
+    free(regp->CRTC);
 
     regp->CRTC =
     regp->Sequencer =
diff --git a/hw/xfree86/xaa/xaaCpyArea.c b/hw/xfree86/xaa/xaaCpyArea.c
index 443a0e1..bcf81ee 100644
--- a/hw/xfree86/xaa/xaaCpyArea.c
+++ b/hw/xfree86/xaa/xaaCpyArea.c
@@ -148,8 +148,8 @@ XAADoBitBlt(
 	    pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
 	    pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2) {
-		if (pptNew2) free(pptNew2);
-		if (pboxNew2) free(pboxNew2);
+		free(pptNew2);
+		free(pboxNew2);
 		if (pboxNew1) {
 		    free(pptNew1);
 		    free(pboxNew1);
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index 8c9d0ed..fbef88d 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -243,8 +243,7 @@ XAADestroyGC(GCPtr pGC)
     if(pGCPriv->XAAOps != &XAAFallbackOps)
 	free(pGCPriv->XAAOps);
 
-    if(pGCPriv->DashPattern)
-	free(pGCPriv->DashPattern);
+    free(pGCPriv->DashPattern);
 
     (*pGC->funcs->DestroyGC)(pGC);
     XAA_GC_FUNC_EPILOGUE (pGC);
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index d0a66b8..ec55632 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -84,11 +84,9 @@ XAADestroyInfoRec(XAAInfoRecPtr infoRec)
     if(infoRec->ClosePixmapCache)
 	(*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen);
    
-    if(infoRec->PreAllocMem)
-	free(infoRec->PreAllocMem);
+    free(infoRec->PreAllocMem);
 
-    if(infoRec->PixmapCachePrivate)
-	free(infoRec->PixmapCachePrivate);
+    free(infoRec->PixmapCachePrivate);
 
     free(infoRec);
 }
diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c
index e017c22..ed3cd48 100644
--- a/hw/xfree86/xaa/xaaLineMisc.c
+++ b/hw/xfree86/xaa/xaaLineMisc.c
@@ -74,8 +74,7 @@ XAAComputeDash(GCPtr pGC)
     int shift, value, direction;
     Bool set;
 
-    if(pGCPriv->DashPattern)
-	free(pGCPriv->DashPattern);
+    free(pGCPriv->DashPattern);
 
     pGCPriv->DashPattern = NULL;
     pGCPriv->DashLength = 0; 
diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c
index f7f6a29..86ac1cd 100644
--- a/hw/xfree86/xaa/xaaPCache.c
+++ b/hw/xfree86/xaa/xaaPCache.c
@@ -144,18 +144,12 @@ FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
 {
     if(!pPriv) return;
 
-    if(pPriv->Info512)
-	free(pPriv->Info512);
-    if(pPriv->Info256)
-	free(pPriv->Info256);
-    if(pPriv->Info128)
-	free(pPriv->Info128);
-    if(pPriv->InfoColor)
-	free(pPriv->InfoColor);
-    if(pPriv->InfoMono)
-	free(pPriv->InfoMono);
-    if(pPriv->InfoPartial)
-	free(pPriv->InfoPartial);
+    free(pPriv->Info512);
+    free(pPriv->Info256);
+    free(pPriv->Info128);
+    free(pPriv->InfoColor);
+    free(pPriv->InfoMono);
+    free(pPriv->InfoPartial);
      
     free(pPriv);
 }
diff --git a/hw/xfree86/xaa/xaaTEText.c b/hw/xfree86/xaa/xaaTEText.c
index 729e8a8..41c0ebc 100644
--- a/hw/xfree86/xaa/xaaTEText.c
+++ b/hw/xfree86/xaa/xaaTEText.c
@@ -299,8 +299,7 @@ XAAGlyphBltTEColorExpansion(
 		skippix, ytop - Top, glyphs + skipglyphs, glyphWidth, 
 		fg, bg, rop, planemask);
 
-	    if (fallbackBits)
-		free(fallbackBits);
+	    free(fallbackBits);
 	}
 
 	nbox--; pbox++;
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 3b60cc9..883b77c 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -214,8 +214,7 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
   free(icws.cmapIDs);
   
   if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
-    if (xnestOldInstalledColormapWindows)
-      free(xnestOldInstalledColormapWindows);
+    free(xnestOldInstalledColormapWindows);
 
 #ifdef _XSERVER64
     {
@@ -264,14 +263,13 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
 #endif /* DUMB_WINDOW_MANAGERS */
   }
   else
-    if (icws.windows) free(icws.windows);
+    free(icws.windows);
 }
 
 void
 xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
 {
-  if (xnestOldInstalledColormapWindows)
-    free(xnestOldInstalledColormapWindows);
+  free(xnestOldInstalledColormapWindows);
   
 #ifdef _XSERVER64
   {
diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c
index ae8262e..edb6ac4 100644
--- a/hw/xwin/winclipboardxevents.c
+++ b/hw/xwin/winclipboardxevents.c
@@ -411,8 +411,7 @@ winClipboardFlushXEvents (HWND hwnd,
 	    xtpText.value = NULL;
 	    xtpText.nitems = 0;
 	  }
-	  if (pszConvertData)
-	    free (pszConvertData);
+	  free(pszConvertData);
 	  if (hGlobal && pszGlobalData)
 	    GlobalUnlock (hGlobal);
 	  
@@ -773,10 +772,8 @@ winClipboardFlushXEvents (HWND hwnd,
 	    xtpText.value = NULL;
 	    xtpText.nitems = 0;
 	  }
-	  if (pszConvertData)
-	    free (pszConvertData);
-	  if (pwszUnicodeStr)
-	    free (pwszUnicodeStr);
+	  free(pszConvertData);
+	  free(pwszUnicodeStr);
 	  if (hGlobal && pszGlobalData)
 	    GlobalUnlock (hGlobal);
 	  if (fSetClipboardData && g_fUnicodeSupport)
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 2ff65bc..cb69c57 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -144,9 +144,7 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
 	      MB_OK | uType);
 
  winMessageBoxF_Cleanup:
-  if (pszErrorF)
-    free(pszErrorF);
-  if (pszMsgBox)
-    free(pszMsgBox);
+  free(pszErrorF);
+  free(pszMsgBox);
 #undef MESSAGEBOXF
 }
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index 93901ca..1996ef0 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -672,8 +672,7 @@ winOverrideIcon (unsigned long longWin)
       {
 	free (res_name);
 	free (res_class);
-	if (wmName)
-	  free (wmName);
+	free(wmName);
 
 	if (pref.icon[i].hicon)
 	  return pref.icon[i].hicon;
@@ -691,8 +690,7 @@ winOverrideIcon (unsigned long longWin)
   /* Didn't find the icon, fail gracefully */
   free (res_name);
   free (res_class);
-  if (wmName)
-    free (wmName);
+  free(wmName);
 
   return 0;
 }
@@ -849,8 +847,7 @@ winOverrideStyle (unsigned long longpWin)
       {
 	free (res_name);
 	free (res_class);
-	if (wmName)
-	  free (wmName);
+	free(wmName);
 
 	if (pref.style[i].type)
 	  return pref.style[i].type;
@@ -860,8 +857,7 @@ winOverrideStyle (unsigned long longpWin)
   /* Didn't find the style, fail gracefully */
   free (res_name);
   free (res_class);
-  if (wmName)
-    free (wmName);
+  free(wmName);
 
   return STYLE_NONE;
 }
diff --git a/mi/miarc.c b/mi/miarc.c
index 5143d2a..db21165 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -3081,10 +3081,8 @@ fillSpans (
 	    (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
 	}
 	disposeFinalSpans ();
-	if (xSpans)
-	    free(xSpans);
-	if (xWidths)
-	    free(xWidths);
+	free(xSpans);
+	free(xWidths);
 	finalMiny = 0;
 	finalMaxy = -1;
 	finalSize = 0;
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 8448483..98857e8 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -150,12 +150,9 @@ miCopyArea(DrawablePtr  pSrcDrawable,
     ordering = malloc(numRects * sizeof(unsigned int));
     if(!pptFirst || !pwidthFirst || !ordering)
     {
-       if (ordering)
-	   free(ordering);
-       if (pwidthFirst)
-           free(pwidthFirst);
-       if (pptFirst)
-           free(pptFirst);
+       free(ordering);
+       free(pwidthFirst);
+       free(pptFirst);
        return NULL;
     }
 
@@ -433,8 +430,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
     pwidth = pwidthFirst = malloc(h * sizeof(int));
     if(!pptFirst || !pwidthFirst)
     {
-	if (pwidthFirst) free(pwidthFirst);
-	if (pptFirst) free(pptFirst);
+	free(pwidthFirst);
+	free(pptFirst);
 	FreeScratchGC(pGCT);
 	return;
     }
@@ -801,10 +798,8 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
         pwidth = pwidthFirst = malloc(h * sizeof(int));
 	if(!pptFirst || !pwidthFirst)
         {
-	   if (pwidthFirst)
-               free(pwidthFirst);
-           if (pptFirst)
-               free(pptFirst);
+	   free(pwidthFirst);
+           free(pptFirst);
            return;
         }
 	if (pGC->miTranslate)
diff --git a/mi/micopy.c b/mi/micopy.c
index b1a7a08..027c461 100644
--- a/mi/micopy.c
+++ b/mi/micopy.c
@@ -108,8 +108,7 @@ miCopyRegion (DrawablePtr   pSrcDrawable,
 	    pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew2)
 	    {
-		if (pboxNew1)
-		    free(pboxNew1);
+		free(pboxNew1);
 		return;
 	    }
 	    pboxBase = pboxNext = pbox;
@@ -143,10 +142,8 @@ miCopyRegion (DrawablePtr   pSrcDrawable,
 		 dx, dy,
 		 reverse, upsidedown, bitPlane, closure);
     
-    if (pboxNew1)
-	free(pboxNew1);
-    if (pboxNew2)
-	free(pboxNew2);
+    free(pboxNew1);
+    free(pboxNew2);
 }
 
 RegionPtr
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index e2bd7c9..1c63a35 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -111,8 +111,8 @@ miPolyFillRect(
     pwFirst = malloc(maxheight * sizeof(int));
     if(!pptFirst || !pwFirst)
     {
-	if (pwFirst) free(pwFirst);
-	if (pptFirst) free(pptFirst);
+	free(pwFirst);
+	free(pptFirst);
 	return;
     }
 
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index 13b5a48..1be0150 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -122,9 +122,9 @@ miFillSppPoly(
 
     if(!ptsOut || !width || !Marked)
     {
-	if (Marked) free(Marked);
-	if (width) free(width);
-	if (ptsOut) free(ptsOut);
+	free(Marked);
+	free(width);
+	free(ptsOut);
 	return;
     }
 
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
index 40671df..2404c56 100644
--- a/mi/mipolycon.c
+++ b/mi/mipolycon.c
@@ -109,8 +109,8 @@ miFillConvexPoly(
     width = FirstWidth = malloc(sizeof(int) * dy);
     if(!FirstPoint || !FirstWidth)
     {
-	if (FirstWidth) free(FirstWidth);
-	if (FirstPoint) free(FirstPoint);
+	free(FirstWidth);
+	free(FirstPoint);
 	return(FALSE);
     }
 
diff --git a/mi/mispans.c b/mi/mispans.c
index 8ac66cc..9f56e3c 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -410,10 +410,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 
 	if (!yspans || !ysizes)
 	{
-	    if (yspans)
-		free(yspans);
-	    if (ysizes)
-		free(ysizes);
+	    free(yspans);
+	    free(ysizes);
 	    miDisposeSpanGroup (spanGroup);
 	    return;
 	}
@@ -492,10 +490,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 	    }
 	    free(yspans);
 	    free(ysizes);
-	    if (points)
-		free(points);
-	    if (widths)
-		free(widths);
+	    free(points);
+	    free(widths);
 	    return;
 	}
 	count = 0;
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 987f772..f5fe765 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -190,8 +190,7 @@ RRCrtcNotify (RRCrtcPtr	    crtc,
 	}
 	else
 	{
-	    if (crtc->outputs)
-		free(crtc->outputs);
+	    free(crtc->outputs);
 	    newoutputs = NULL;
 	}
 	crtc->outputs = newoutputs;
@@ -440,8 +439,7 @@ RRCrtcDestroyResource (pointer value, XID pid)
 	    }
 	}
     }
-    if (crtc->gammaRed)
-	free(crtc->gammaRed);
+    free(crtc->gammaRed);
     if (crtc->mode)
 	RRModeDestroy (crtc->mode);
     free(crtc);
@@ -563,8 +561,7 @@ RRCrtcGammaSetSize (RRCrtcPtr	crtc,
     }
     else
 	gamma = NULL;
-    if (crtc->gammaRed)
-	free(crtc->gammaRed);
+    free(crtc->gammaRed);
     crtc->gammaRed = gamma;
     crtc->gammaGreen = gamma + size;
     crtc->gammaBlue = gamma + size*2;
@@ -805,8 +802,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 				     RROutputType, client, DixSetAttrAccess);
 	if (rc != Success)
 	{
-	    if (outputs)
-		free(outputs);
+	    free(outputs);
 	    return rc;
 	}
 	/* validate crtc for this output */
@@ -815,8 +811,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 		break;
 	if (j == outputs[i]->numCrtcs)
 	{
-	    if (outputs)
-		free(outputs);
+	    free(outputs);
 	    return BadMatch;
 	}
 	/* validate mode for this output */
@@ -830,8 +825,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	}
 	if (j == outputs[i]->numModes + outputs[i]->numUserModes)
 	{
-	    if (outputs)
-		free(outputs);
+	    free(outputs);
 	    return BadMatch;
 	}
     }
@@ -850,8 +844,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	    }
 	    if (k == outputs[i]->numClones)
 	    {
-		if (outputs)
-		    free(outputs);
+		free(outputs);
 		return BadMatch;
 	    }
 	}
@@ -900,8 +893,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	 * Invalid rotation
 	 */
 	client->errorValue = stuff->rotation;
-	if (outputs)
-	    free(outputs);
+	free(outputs);
 	return BadValue;
     }
 
@@ -913,8 +905,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	     * requested rotation or reflection not supported by screen
 	     */
 	    client->errorValue = stuff->rotation;
-	    if (outputs)
-		free(outputs);
+	    free(outputs);
 	    return BadMatch;
 	}
     
@@ -943,16 +934,14 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	    if (stuff->x + source_width > pScreen->width)
 	    {
 		client->errorValue = stuff->x;
-		if (outputs)
-		    free(outputs);
+		free(outputs);
 		return BadValue;
 	    }
 	    
 	    if (stuff->y + source_height > pScreen->height)
 	    {
 		client->errorValue = stuff->y;
-		if (outputs)
-		    free(outputs);
+		free(outputs);
 		return BadValue;
 	    }
 	}
@@ -979,8 +968,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
     pScrPriv->lastSetTime = time;
     
 sendReply:
-    if (outputs)
-	free(outputs);
+    free(outputs);
     
     rep.type = X_Reply;
     /* rep.status has already been filled in */
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 7822c0d..937b14d 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -134,8 +134,7 @@ RROutputSetClones (RROutputPtr  output,
     }
     else
 	newClones = NULL;
-    if (output->clones)
-	free(output->clones);
+    free(output->clones);
     memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
     output->clones = newClones;
     output->numClones = numClones;
@@ -280,8 +279,7 @@ RROutputSetCrtcs (RROutputPtr	output,
     }
     else
 	newCrtcs = NULL;
-    if (output->crtcs)
-	free(output->crtcs);
+    free(output->crtcs);
     memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
     output->crtcs = newCrtcs;
     output->numCrtcs = numCrtcs;
@@ -402,13 +400,10 @@ RROutputDestroyResource (pointer value, XID pid)
     
     for (m = 0; m < output->numUserModes; m++)
 	RRModeDestroy (output->userModes[m]);
-    if (output->userModes)
-	free(output->userModes);
+    free(output->userModes);
 
-    if (output->crtcs)
-	free(output->crtcs);
-    if (output->clones)
-	free(output->clones);
+    free(output->crtcs);
+    free(output->clones);
     RRDeleteAllOutputProperties (output);
     free(output);
     return 1;
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 5e37577..a4402e1 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -69,10 +69,8 @@ RRDeleteAllOutputProperties (RROutputPtr output)
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
 	RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
-	if (prop->current.data)
-	    free(prop->current.data);
-	if (prop->pending.data)
-	    free(prop->pending.data);
+	free(prop->current.data);
+	free(prop->pending.data);
 	free(prop);
     }
 }
@@ -109,14 +107,10 @@ RRCreateOutputProperty (Atom property)
 static void
 RRDestroyOutputProperty (RRPropertyPtr prop)
 {
-    if (prop->valid_values)
-	free(prop->valid_values);
-    if (prop->current.data)
-	free(prop->current.data);
-    if (prop->pending.data)
-	free(prop->pending.data);
-    if (prop->valid_values)
-	free(prop->valid_values);
+    free(prop->valid_values);
+    free(prop->current.data);
+    free(prop->pending.data);
+    free(prop->valid_values);
     free(prop);
 }
 
@@ -232,12 +226,10 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
 	    !pScrPriv->rrOutputSetProperty(output->pScreen, output,
 					   prop->propertyName, &new_value))
 	{
-	    if (new_value.data)
-		free(new_value.data);
+	    free(new_value.data);
 	    return (BadValue);
 	}
-	if (prop_value->data)
-	    free(prop_value->data);
+	free(prop_value->data);
 	*prop_value = new_value;
     }
 
@@ -378,8 +370,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
      */
     if (prop->is_pending && !pending)
     {
-	if (prop->pending.data)
-	    free(prop->pending.data);
+	free(prop->pending.data);
 	RRInitOutputPropertyValue (&prop->pending);
     }
 
@@ -387,8 +378,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
     prop->range = range;
     prop->immutable = immutable;
     prop->num_valid = num_values;
-    if (prop->valid_values)
-	free(prop->valid_values);
+    free(prop->valid_values);
     prop->valid_values = new_values;
 
     if (add) {
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index a2a0f36..f58e657 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -951,8 +951,7 @@ ProcRRSetScreenConfig (ClientPtr client)
     
 sendReply:
     
-    if (pData)
-	free(pData);
+    free(pData);
 
     rep.type = X_Reply;
     /* rep.status has already been filled in */
diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 7fd4fa0..a470e1e 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -37,8 +37,7 @@ RRTransformInit (RRTransformPtr transform)
 void
 RRTransformFini (RRTransformPtr transform)
 {
-    if (transform->params)
-	free(transform->params);
+    free(transform->params);
 }
 
 Bool
@@ -82,8 +81,7 @@ RRTransformSetFilter (RRTransformPtr	dst,
     }
     else
 	new_params = NULL;
-    if (dst->params)
-	free(dst->params);
+    free(dst->params);
     dst->filter = filter;
     dst->params = new_params;
     dst->nparams = nparams;
diff --git a/record/record.c b/record/record.c
index 5bd46c2..53bdfec 100644
--- a/record/record.c
+++ b/record/record.c
@@ -1868,8 +1868,7 @@ bailout:
     if (si)
     {
 	for (i = 0; i < maxSets; i++)
-	    if (si[i].intervals)
-		free(si[i].intervals);
+	    free(si[i].intervals);
 	free(si);
     }
     if (pCanonClients && pCanonClients != (XID *)&stuff[1])
@@ -1955,8 +1954,7 @@ ProcRecordCreateContext(ClientPtr client)
 	err = BadAlloc;
     }
 bailout:
-    if (pContext)
-	free(pContext);
+    free(pContext);
     return err;
 } /* ProcRecordCreateContext */
 
@@ -2352,7 +2350,7 @@ ProcRecordGetContext(ClientPtr client)
 bailout:
     for (i = 0; i < nRCAPs; i++)
     {
-	if (pRangeInfo[i].pRanges) free(pRangeInfo[i].pRanges);
+	free(pRangeInfo[i].pRanges);
     }
     free(pRangeInfo);
     return err;
diff --git a/record/set.c b/record/set.c
index f2064fd..a9a6a44 100644
--- a/record/set.c
+++ b/record/set.c
@@ -360,7 +360,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
     memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
     prls->nIntervals = nIntervals;
 bailout:
-    if (stackIntervals) free(stackIntervals);
+    free(stackIntervals);
     return (RecordSetPtr)prls;
 }
 
diff --git a/render/picture.c b/render/picture.c
index f55711d..7fda6b9 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1524,8 +1524,7 @@ FreePicture (pointer	value,
 
     if (--pPicture->refcnt == 0)
     {
-	if (pPicture->transform)
-	    free(pPicture->transform);
+	free(pPicture->transform);
 
 	if (pPicture->pSourcePict)
 	{
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index f155cc8..796931c 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -183,8 +183,7 @@ _XkbClearColor(char *color_in)
 {
 XkbColorPtr	color= (XkbColorPtr)color_in;
 
-    if (color->spec)
-	free(color->spec);
+    free(color->spec);
     return;
 }
 
@@ -663,8 +662,7 @@ register XkbPropertyPtr prop;
 	return NULL;
     for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
 	if ((prop->name)&&(strcmp(name,prop->name)==0)) {
-	    if (prop->value)
-		free(prop->value);
+	    free(prop->value);
 	    prop->value= malloc(strlen(value)+1);
 	    if (prop->value)
 		strcpy(prop->value,value);
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index abe0018..197523f 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -312,8 +312,7 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
 	if ((map_count>type->map_count)||(type->map==NULL))
 	    type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec));
 	if (!type->map) {
-	    if (prev_map) 
-		free(prev_map);
+	    free(prev_map);
 	    return BadAlloc;
 	}
 	if (want_preserve) {
@@ -324,8 +323,7 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
 					  map_count * sizeof(XkbModsRec));
 	    }
 	    if (!type->preserve) {
-		if (prev_preserve) 
-		    free(prev_preserve);
+		free(prev_preserve);
 		return BadAlloc;
 	    }
 	}
@@ -342,8 +340,7 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
 	type->level_names = realloc(type->level_names,
 				     new_num_lvls * sizeof(Atom));
 	if (!type->level_names) {
-	    if (prev_level_names) 
-		free(prev_level_names);
+	    free(prev_level_names);
 	    return BadAlloc;
 	}
     }
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 5aabd1c..c683c0d 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -553,9 +553,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
 static void
 FreeMultiDefs(XkbRF_MultiDefsPtr defs)
 {
-  if (defs->options) free(defs->options);
-  if (defs->layout[1])  free(defs->layout[1]);
-  if (defs->variant[1])  free(defs->variant[1]);
+  free(defs->options);
+  free(defs->layout[1]);
+  free(defs->variant[1]);
 }
 
 static void
@@ -988,15 +988,15 @@ XkbRF_GroupPtr	group;
 	return;
     if (rules->rules) {
 	for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
-	    if (rule->model)	free(rule->model);
-	    if (rule->layout)	free(rule->layout);
-	    if (rule->variant)	free(rule->variant);
-	    if (rule->option)	free(rule->option);
-	    if (rule->keycodes)	free(rule->keycodes);
-	    if (rule->symbols)	free(rule->symbols);
-	    if (rule->types)	free(rule->types);
-	    if (rule->compat)	free(rule->compat);
-	    if (rule->geometry)	free(rule->geometry);
+	    free(rule->model);
+	    free(rule->layout);
+	    free(rule->variant);
+	    free(rule->option);
+	    free(rule->keycodes);
+	    free(rule->symbols);
+	    free(rule->types);
+	    free(rule->compat);
+	    free(rule->geometry);
 	    memset((char *)rule, 0, sizeof(XkbRF_RuleRec));
 	}
 	free(rules->rules);
@@ -1006,8 +1006,8 @@ XkbRF_GroupPtr	group;
 
     if (rules->groups) {
 	for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
-	    if (group->name)	free(group->name);
-	    if (group->words)	free(group->words);
+	    free(group->name);
+	    free(group->words);
 	}
 	free(rules->groups);
 	rules->num_groups= 0;
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 0f3ffa4..bd58243 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -220,20 +220,15 @@ char *			pval;
 static void
 XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
 {
-    if (XkbRulesUsed)
-        free(XkbRulesUsed);
+    free(XkbRulesUsed);
     XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL);
-    if (XkbModelUsed)
-	free(XkbModelUsed);
+    free(XkbModelUsed);
     XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL);
-    if (XkbLayoutUsed)
-	free(XkbLayoutUsed);
+    free(XkbLayoutUsed);
     XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL);
-    if (XkbVariantUsed)
-	free(XkbVariantUsed);
+    free(XkbVariantUsed);
     XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL);
-    if (XkbOptionsUsed)
-	free(XkbOptionsUsed);
+    free(XkbOptionsUsed);
     XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL);
     if (XkbWantRulesProp)
 	QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
@@ -244,28 +239,23 @@ void
 XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
 {
     if (rmlvo->rules) {
-        if (XkbRulesDflt)
-	    free(XkbRulesDflt);
+        free(XkbRulesDflt);
         XkbRulesDflt= _XkbDupString(rmlvo->rules);
     }
     if (rmlvo->model) {
-	if (XkbModelDflt)
-	    free(XkbModelDflt);
+	free(XkbModelDflt);
 	XkbModelDflt= _XkbDupString(rmlvo->model);
     }
     if (rmlvo->layout) {
-	if (XkbLayoutDflt)
-	    free(XkbLayoutDflt);
+	free(XkbLayoutDflt);
 	XkbLayoutDflt= _XkbDupString(rmlvo->layout);
     }
     if (rmlvo->variant) {
-	if (XkbVariantDflt)
-	    free(XkbVariantDflt);
+	free(XkbVariantDflt);
 	XkbVariantDflt= _XkbDupString(rmlvo->variant);
     }
     if (rmlvo->options) {
-	if (XkbOptionsDflt)
-	    free(XkbOptionsDflt);
+	free(XkbOptionsDflt);
 	XkbOptionsDflt= _XkbDupString(rmlvo->options);
     }
     return;
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index d75f920..ae3666f 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -605,8 +605,8 @@ void
 XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli)
 {
     if ((sli->flags&XkbSLI_IsDefault)==0) {
-	if (sli->maps)	free(sli->maps);
-	if (sli->names)	free(sli->names);
+	free(sli->maps);
+	free(sli->names);
     }
     sli->maps= NULL;
     sli->names= NULL;
-- 
1.7.1



More information about the xorg-devel mailing list