diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-06-06 15:28:30 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-06-06 20:27:18 +0700 |
commit | 0a4d8cbdcd7b25313fb29ccdb498044af95f7de6 (patch) | |
tree | 3534c9035180b7e0d2ebbbf0202a370cb61f8e8d /hw | |
parent | 5a0fc0ad21d562612676ef88ef2d533b2391810a (diff) |
Remove more superfluous if(p) checks around free(p)
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@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'hw')
41 files changed, 80 insertions, 134 deletions
diff --git a/hw/dmx/config/dmxparse.c b/hw/dmx/config/dmxparse.c index 28a1835af..35f1c2185 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 4532960b5..bf4b92cb2 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 8a03c65ce..7cd50dadf 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 41b0eb27c..c3f1d3b36 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 cfd026979..18fd43ac4 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 58151b7f2..4c64db24a 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 55615cf39..e917a5c42 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 80df0649e..7ec209df0 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 814fc1a89..b2e16fba4 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 050c80ebf..5bfb8813c 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 549df46e2..ee187072c 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 70918eef4..3a220cf01 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 95c00b839..25479aea6 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 1cf0f2e21..b8306db0a 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 5b236af78..167bc7805 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 f6c56336e..0d27fd585 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 ac1f28361..394fb06b9 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 356ddab4c..c3a1dddc4 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 f26c22c59..d2a8f12b8 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 ea8c3e154..30a420249 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 b02fdafa2..363136986 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 db4cd7b00..61bbe9aa0 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 39a92c8bc..8ac50a620 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 871bfdac5..defe560ba 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 60003d502..304d503c8 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 a4cf4f08c..ca419ecb9 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 4cc99ad21..fdc38c5a6 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 699f15ceb..f4fea286c 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 52e80a961..05fbc8995 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 0015b76b8..f4d127442 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 3ae2dfa5a..b6832c30a 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 443a0e15e..bcf81ee99 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 8c9d0ede7..fbef88d77 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 d0a66b8d8..ec55632e9 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 e017c22f8..ed3cd486b 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 f7f6a29bb..86ac1cd14 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 729e8a8cb..41c0ebcfd 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 3b60cc95d..883b77cb2 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 ae8262ebf..edb6ac4bd 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 2ff65bc9d..cb69c57c2 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 93901cac7..1996ef0ef 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; } |