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>
This commit is contained in:
Mikhail Gusarov 2010-06-06 15:28:30 +07:00
parent 5a0fc0ad21
commit 0a4d8cbdcd
84 changed files with 240 additions and 412 deletions

View File

@ -1276,7 +1276,6 @@ XineramaGetImageData(
} }
if(ScratchMem)
free(ScratchMem); free(ScratchMem);
RegionUninit(&SrcRegion); RegionUninit(&SrcRegion);

View File

@ -604,7 +604,7 @@ bailout:
if (removeAuth) if (removeAuth)
RemoveAuthorization(stuff->nbytesAuthProto, protoname, RemoveAuthorization(stuff->nbytesAuthProto, protoname,
authdata_len, pAuthdata); authdata_len, pAuthdata);
if (pAuth) free(pAuth); free(pAuth);
return err; return err;
} /* ProcSecurityGenerateAuthorization */ } /* ProcSecurityGenerateAuthorization */

View File

@ -323,7 +323,7 @@ XaceCensorImage(
*/ */
memset(pBuf, 0, (int)(widthBytesLine * h)); memset(pBuf, 0, (int)(widthBytesLine * h));
} }
if (pRects) free(pRects); free(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC); if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix); if (pPix) FreeScratchPixmapHeader(pPix);
} }

View File

@ -259,7 +259,6 @@ ProcXvMCCreateContext(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data); WriteToClient(client, dwords << 2, (char*)data);
AddResource(pContext->context_id, XvMCRTContext, pContext); AddResource(pContext->context_id, XvMCRTContext, pContext);
if(data)
free(data); free(data);
return Success; return Success;
@ -327,7 +326,6 @@ ProcXvMCCreateSurface(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data); WriteToClient(client, dwords << 2, (char*)data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface); AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
if(data)
free(data); free(data);
pContext->refcnt++; pContext->refcnt++;
@ -444,7 +442,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data); WriteToClient(client, dwords << 2, (char*)data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture); AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
if(data)
free(data); free(data);
pContext->refcnt++; pContext->refcnt++;

View File

@ -153,7 +153,6 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
} }
WriteToClient(client, length * 4, (char *)coords); WriteToClient(client, length * 4, (char *)coords);
} }
if (coords)
free(coords); free(coords);
return Success; return Success;
} }

View File

@ -622,7 +622,6 @@ XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
static void static void
XIDestroyDeviceProperty (XIPropertyPtr prop) XIDestroyDeviceProperty (XIPropertyPtr prop)
{ {
if (prop->value.data)
free(prop->value.data); free(prop->value.data);
free(prop); free(prop);
} }
@ -798,7 +797,6 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
&new_value, checkonly); &new_value, checkonly);
if (checkonly && rc != Success) if (checkonly && rc != Success)
{ {
if (new_value.data)
free(new_value.data); free(new_value.data);
return (rc); return (rc);
} }
@ -808,7 +806,6 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
checkonly = !checkonly; checkonly = !checkonly;
} while (!checkonly); } while (!checkonly);
} }
if (prop_value->data)
free(prop_value->data); free(prop_value->data);
*prop_value = new_value; *prop_value = new_value;
} else if (len == 0) } else if (len == 0)

View File

@ -184,9 +184,7 @@ unwind:
while (options) { while (options) {
tmpo = options; tmpo = options;
options = options->next; options = options->next;
if (tmpo->key)
free(tmpo->key); free(tmpo->key);
if (tmpo->value)
free(tmpo->value); free(tmpo->value);
free(tmpo); free(tmpo);
} }

View File

@ -251,27 +251,22 @@ device_added(LibHalContext *hal_ctx, const char *udi)
{ {
if (!strcasecmp(&tmp[3], "layout")) if (!strcasecmp(&tmp[3], "layout"))
{ {
if (xkb_opts.layout)
free(xkb_opts.layout); free(xkb_opts.layout);
xkb_opts.layout = strdup(tmp_val); xkb_opts.layout = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "model")) } else if (!strcasecmp(&tmp[3], "model"))
{ {
if (xkb_opts.model)
free(xkb_opts.model); free(xkb_opts.model);
xkb_opts.model = strdup(tmp_val); xkb_opts.model = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "rules")) } else if (!strcasecmp(&tmp[3], "rules"))
{ {
if (xkb_opts.rules)
free(xkb_opts.rules); free(xkb_opts.rules);
xkb_opts.rules = strdup(tmp_val); xkb_opts.rules = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "variant")) } else if (!strcasecmp(&tmp[3], "variant"))
{ {
if (xkb_opts.variant)
free(xkb_opts.variant); free(xkb_opts.variant);
xkb_opts.variant = strdup(tmp_val); xkb_opts.variant = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "options")) } else if (!strcasecmp(&tmp[3], "options"))
{ {
if (xkb_opts.options)
free(xkb_opts.options); free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val); xkb_opts.options = strdup(tmp_val);
} }
@ -289,7 +284,6 @@ device_added(LibHalContext *hal_ctx, const char *udi)
(!strcasecmp(&tmp[3], "options")) && (!strcasecmp(&tmp[3], "options")) &&
(tmp_val = get_prop_string_array(hal_ctx, udi, psi_key))) (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); xkb_opts.options = strdup(tmp_val);
} }
@ -366,7 +360,6 @@ device_added(LibHalContext *hal_ctx, const char *udi)
} }
for (; dev; dev = dev->next){ for (; dev; dev = dev->next){
if (dev->config_info)
free(dev->config_info); free(dev->config_info);
dev->config_info = xstrdup(config_info); dev->config_info = xstrdup(config_info);
} }
@ -374,13 +367,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
unwind: unwind:
if (set) if (set)
libhal_free_property_set(set); libhal_free_property_set(set);
if (path)
free(path); free(path);
if (driver)
free(driver); free(driver);
if (name)
free(name); free(name);
if (config_info)
free(config_info); free(config_info);
while (!dev && (tmpo = options)) { while (!dev && (tmpo = options)) {
options = tmpo->next; options = tmpo->next;
@ -401,15 +390,10 @@ unwind:
free(attrs.tags); free(attrs.tags);
} }
if (xkb_opts.layout)
free(xkb_opts.layout); free(xkb_opts.layout);
if (xkb_opts.rules)
free(xkb_opts.rules); free(xkb_opts.rules);
if (xkb_opts.model)
free(xkb_opts.model); free(xkb_opts.model);
if (xkb_opts.variant)
free(xkb_opts.variant); free(xkb_opts.variant);
if (xkb_opts.options)
free(xkb_opts.options); free(xkb_opts.options);
dbus_error_free(&error); dbus_error_free(&error);

View File

@ -692,11 +692,8 @@ ProcDbeGetVisualInfo(ClientPtr client)
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n; count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count * if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count *
sizeof(XdbeScreenVisualInfo)))) sizeof(XdbeScreenVisualInfo))))
{
if (pDrawables)
{ {
free(pDrawables); free(pDrawables);
}
return(BadAlloc); return(BadAlloc);
} }
@ -722,10 +719,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
} }
/* Free pDrawables if we needed to allocate it above. */ /* Free pDrawables if we needed to allocate it above. */
if (pDrawables)
{
free(pDrawables); free(pDrawables);
}
return (rc == Success) ? BadAlloc : rc; return (rc == Success) ? BadAlloc : rc;
} }
@ -803,10 +797,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
} }
free(pScrVisInfo); free(pScrVisInfo);
if (pDrawables)
{
free(pDrawables); free(pDrawables);
}
return Success; return Success;

View File

@ -1639,8 +1639,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes,
pcr->client = client; pcr->client = client;
if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
ok = BadAlloc; ok = BadAlloc;
} else if (pcr) } else free(pcr);
free(pcr);
return (ok); return (ok);
} }
@ -1730,8 +1729,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors,
pcr->client = client; pcr->client = client;
if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
ok = BadAlloc; ok = BadAlloc;
} else if (pcr) } else free(pcr);
free(pcr);
return (ok); 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)); ppixBlue = malloc(npixB * sizeof(Pixel));
if (!ppixRed || !ppixGreen || !ppixBlue) if (!ppixRed || !ppixGreen || !ppixBlue)
{ {
if (ppixBlue) free(ppixBlue); free(ppixBlue);
if (ppixGreen) free(ppixGreen); free(ppixGreen);
if (ppixRed) free(ppixRed); free(ppixRed);
return(BadAlloc); return(BadAlloc);
} }

View File

@ -740,7 +740,6 @@ FreeDeviceClass(int type, pointer *class)
case ButtonClass: case ButtonClass:
{ {
ButtonClassPtr *b = (ButtonClassPtr*)class; ButtonClassPtr *b = (ButtonClassPtr*)class;
if ((*b)->xkb_acts)
free((*b)->xkb_acts); free((*b)->xkb_acts);
free((*b)); free((*b));
break; break;
@ -749,7 +748,6 @@ FreeDeviceClass(int type, pointer *class)
{ {
ValuatorClassPtr *v = (ValuatorClassPtr*)class; ValuatorClassPtr *v = (ValuatorClassPtr*)class;
if ((*v)->motion)
free((*v)->motion); free((*v)->motion);
free((*v)); free((*v));
break; break;
@ -1465,9 +1463,7 @@ InitStringFeedbackClassDeviceStruct (
feedc->ctrl.symbols_displayed = malloc(sizeof (KeySym) * max_symbols); feedc->ctrl.symbols_displayed = malloc(sizeof (KeySym) * max_symbols);
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
{ {
if (feedc->ctrl.symbols_supported)
free(feedc->ctrl.symbols_supported); free(feedc->ctrl.symbols_supported);
if (feedc->ctrl.symbols_displayed)
free(feedc->ctrl.symbols_displayed); free(feedc->ctrl.symbols_displayed);
free(feedc); free(feedc);
return FALSE; return FALSE;
@ -2283,7 +2279,6 @@ ProcGetMotionEvents(ClientPtr client)
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord), WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
(char *)coords); (char *)coords);
} }
if (coords)
free(coords); free(coords);
return Success; return Success;
} }

View File

@ -2837,7 +2837,7 @@ ProcQueryColors(ClientPtr client)
return(BadAlloc); return(BadAlloc);
if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) ) if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) )
{ {
if (prgbs) free(prgbs); free(prgbs);
return rc; return rc;
} }
memset(&qcr, 0, sizeof(xQueryColorsReply)); memset(&qcr, 0, sizeof(xQueryColorsReply));
@ -2851,7 +2851,7 @@ ProcQueryColors(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
} }
if (prgbs) free(prgbs); free(prgbs);
return Success; return Success;
} }

View File

@ -677,7 +677,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
return TRUE; return TRUE;
} }
if (err == FontNameAlias) { if (err == FontNameAlias) {
if (resolved) free(resolved); free(resolved);
resolved = malloc(resolvedlen + 1); resolved = malloc(resolvedlen + 1);
if (resolved) if (resolved)
memmove(resolved, tmpname, resolvedlen + 1); memmove(resolved, tmpname, resolvedlen + 1);
@ -731,7 +731,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
{ {
c->saved = c->current; c->saved = c->current;
c->haveSaved = TRUE; c->haveSaved = TRUE;
if (c->savedName)
free(c->savedName); free(c->savedName);
c->savedName = malloc(namelen + 1); c->savedName = malloc(namelen + 1);
if (c->savedName) if (c->savedName)
@ -828,10 +827,10 @@ bail:
for (i = 0; i < c->num_fpes; i++) for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
free(c->fpe_list); free(c->fpe_list);
if (c->savedName) free(c->savedName); free(c->savedName);
FreeFontNames(names); FreeFontNames(names);
free(c); free(c);
if (resolved) free(resolved); free(resolved);
return TRUE; return TRUE;
} }
@ -994,7 +993,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
c->saved = c->current; c->saved = c->current;
c->haveSaved = TRUE; c->haveSaved = TRUE;
c->savedNumFonts = numFonts; c->savedNumFonts = numFonts;
if (c->savedName)
free(c->savedName); free(c->savedName);
c->savedName = malloc(namelen + 1); c->savedName = malloc(namelen + 1);
if (c->savedName) if (c->savedName)
@ -1106,7 +1104,7 @@ bail:
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
free(c->reply); free(c->reply);
free(c->fpe_list); free(c->fpe_list);
if (c->savedName) free(c->savedName); free(c->savedName);
free(c); free(c);
return TRUE; return TRUE;
} }

View File

@ -893,7 +893,7 @@ InitCallbackManager(void)
{ {
DeleteCallbackList(listsToCleanup[i]); DeleteCallbackList(listsToCleanup[i]);
} }
if (listsToCleanup) free(listsToCleanup); free(listsToCleanup);
numCallbackListsToCleanup = 0; numCallbackListsToCleanup = 0;
listsToCleanup = NULL; listsToCleanup = NULL;

View File

@ -3793,9 +3793,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
} }
unwind: unwind:
if (xE)
free(xE); free(xE);
if (xi2)
free(xi2); free(xi2);
return; return;
} }
@ -3976,9 +3974,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
} }
} }
if (xi)
free(xi); free(xi);
if (xi2)
free(xi2); free(xi2);
} }

View File

@ -327,7 +327,6 @@ void
AllocateMotionHistory(DeviceIntPtr pDev) AllocateMotionHistory(DeviceIntPtr pDev)
{ {
int size; int size;
if (pDev->valuator->motion)
free(pDev->valuator->motion); free(pDev->valuator->motion);
if (pDev->valuator->numMotionEvents < 1) if (pDev->valuator->numMotionEvents < 1)

View File

@ -441,10 +441,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
details = malloc(i * sizeof(Mask *)); details = malloc(i * sizeof(Mask *));
if (!deletes || !adds || !updates || !details) if (!deletes || !adds || !updates || !details)
{ {
if (details) free(details); free(details);
if (updates) free(updates); free(updates);
if (adds) free(adds); free(adds);
if (deletes) free(deletes); free(deletes);
return FALSE; return FALSE;
} }

View File

@ -762,7 +762,6 @@ RegionOp(
AppendRegions(newReg, r2BandEnd, r2End); AppendRegions(newReg, r2BandEnd, r2End);
} }
if (oldData)
free(oldData); free(oldData);
if (!(numRects = newReg->data->numRects)) if (!(numRects = newReg->data->numRects))

View File

@ -257,7 +257,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
pExaPixmap->driverPriv = NULL; pExaPixmap->driverPriv = NULL;
if (pExaPixmap->pDamage) { if (pExaPixmap->pDamage) {
if (pExaPixmap->sys_ptr)
free(pExaPixmap->sys_ptr); free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = NULL; pExaPixmap->sys_ptr = NULL;
pExaPixmap->pDamage = NULL; pExaPixmap->pDamage = NULL;

View File

@ -2431,7 +2431,6 @@ int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major; cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor; cl->GLClientminorVersion = req->minor;
if (cl->GLClientextensions)
free(cl->GLClientextensions); free(cl->GLClientextensions);
buf = (const char *)(req+1); buf = (const char *)(req+1);
cl->GLClientextensions = xstrdup(buf); cl->GLClientextensions = xstrdup(buf);

View File

@ -205,8 +205,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
{ {
if (cx->idExists || cx->isCurrent) return GL_FALSE; if (cx->idExists || cx->isCurrent) return GL_FALSE;
if (cx->feedbackBuf) free(cx->feedbackBuf); free(cx->feedbackBuf);
if (cx->selectBuf) free(cx->selectBuf); free(cx->selectBuf);
if (cx == __glXLastContext) { if (cx == __glXLastContext) {
__glXFlushContextCache(); __glXFlushContextCache();
} }
@ -323,10 +323,10 @@ glxClientCallback (CallbackListPtr *list,
} }
} }
if (cl->returnBuf) free(cl->returnBuf); free(cl->returnBuf);
if (cl->largeCmdBuf) free(cl->largeCmdBuf); free(cl->largeCmdBuf);
if (cl->currentContexts) free(cl->currentContexts); free(cl->currentContexts);
if (cl->GLClientextensions) free(cl->GLClientextensions); free(cl->GLClientextensions);
break; break;
default: default:

View File

@ -272,9 +272,7 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
s2 = sext_string; s2 = sext_string;
} }
if (!combo_string || !s1) { if (!combo_string || !s1) {
if (combo_string)
free(combo_string); free(combo_string);
if (s1)
free(s1); free(s1);
return NULL; return NULL;
} }

View File

@ -97,9 +97,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
pci->metrics.characterWidth, 0, pci->metrics.characterWidth, 0,
allocbuf ? allocbuf : buf) ); allocbuf ? allocbuf : buf) );
if (allocbuf) {
free(allocbuf); free(allocbuf);
}
return Success; return Success;
#undef __GL_CHAR_BUF_SIZE #undef __GL_CHAR_BUF_SIZE
} }

View File

@ -98,7 +98,7 @@ const char *dmxConfigCopyString(const char *string, int length)
void dmxConfigFree(void *area) void dmxConfigFree(void *area)
{ {
if (area) free(area); free(area);
} }
DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
@ -370,7 +370,7 @@ DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
void dmxConfigFreeOption(DMXConfigOptionPtr p) void dmxConfigFreeOption(DMXConfigOptionPtr p)
{ {
if (!p) return; if (!p) return;
if (p->string) free(p->string); free(p->string);
dmxConfigFreeToken(p->start); dmxConfigFreeToken(p->start);
dmxConfigFreeString(p->option); dmxConfigFreeString(p->option);
dmxConfigFreeToken(p->end); dmxConfigFreeToken(p->end);

View File

@ -351,7 +351,7 @@ do { \
#define MAXSCREENSFREE(o) \ #define MAXSCREENSFREE(o) \
do { \ do { \
if (o) free(o); \ free(o); \
o = NULL; \ o = NULL; \
} while (0) } while (0)

View File

@ -606,8 +606,8 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
dmxScreens[i].stat = NULL; dmxScreens[i].stat = NULL;
} }
for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]); for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
if (dmxScreens) free(dmxScreens); free(dmxScreens);
if (dmxInputs) free(dmxInputs); free(dmxInputs);
dmxScreens = NULL; dmxScreens = NULL;
dmxInputs = NULL; dmxInputs = NULL;
dmxNumScreens = 0; dmxNumScreens = 0;

View File

@ -122,7 +122,7 @@ DMXStatInfo *dmxStatAlloc(void)
/** Free the memory used by a \a DMXStatInfo structure. */ /** Free the memory used by a \a DMXStatInfo structure. */
void dmxStatFree(DMXStatInfo *pt) void dmxStatFree(DMXStatInfo *pt)
{ {
if (pt) free(pt); free(pt);
} }
static void dmxStatValue(DMXStatAvg *data, unsigned long value) static void dmxStatValue(DMXStatAvg *data, unsigned long value)

View File

@ -105,7 +105,5 @@ __glXRealloc(void *addr, size_t newSize)
void void
__glXFree(void *addr) __glXFree(void *addr)
{ {
if (addr) {
free(addr); free(addr);
} }
}

View File

@ -531,7 +531,6 @@ Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
__glXFree(pNewVisualConfigs); __glXFree(pNewVisualConfigs);
/* Free the private list created by DDX HW driver */ /* Free the private list created by DDX HW driver */
if (visualPrivates)
free(visualPrivates); free(visualPrivates);
visualPrivates = NULL; visualPrivates = NULL;

View File

@ -114,7 +114,7 @@ pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice)
* #dmxBackendCreatePrivate. */ * #dmxBackendCreatePrivate. */
void dmxBackendDestroyPrivate(pointer private) void dmxBackendDestroyPrivate(pointer private)
{ {
if (private) free(private); free(private);
} }
static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure) static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure)

View File

@ -148,7 +148,7 @@ pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
/** If \a private is non-NULL, free its associated memory. */ /** If \a private is non-NULL, free its associated memory. */
void dmxConsoleDestroyPrivate(pointer private) void dmxConsoleDestroyPrivate(pointer private)
{ {
if (private) free(private); free(private);
} }
static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect) static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect)

View File

@ -1084,9 +1084,9 @@ static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
if (local->isCore && local->type == DMX_LOCAL_KEYBOARD) if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
dmxLocalCoreKeyboard = NULL; dmxLocalCoreKeyboard = NULL;
if (local->destroy_private) local->destroy_private(local->private); if (local->destroy_private) local->destroy_private(local->private);
if (local->history) free(local->history); free(local->history);
if (local->valuators) free(local->valuators); free(local->valuators);
if (local->deviceName) free(local->deviceName); free(local->deviceName);
local->private = NULL; local->private = NULL;
local->history = NULL; local->history = NULL;
local->deviceName = NULL; local->deviceName = NULL;
@ -1100,9 +1100,9 @@ void dmxInputFree(DMXInputInfo *dmxInput)
if (!dmxInput) return; if (!dmxInput) return;
if (dmxInput->keycodes) free(dmxInput->keycodes); free(dmxInput->keycodes);
if (dmxInput->symbols) free(dmxInput->symbols); free(dmxInput->symbols);
if (dmxInput->geometry) free(dmxInput->geometry); free(dmxInput->geometry);
for (i = 0; i < dmxInput->numDevs; i++) { for (i = 0; i < dmxInput->numDevs; i++) {
dmxInputFreeLocal(dmxInput->devs[i]); dmxInputFreeLocal(dmxInput->devs[i]);

View File

@ -368,7 +368,7 @@ pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
/** Destroy a private structure. */ /** Destroy a private structure. */
void kbdLinuxDestroyPrivate(pointer priv) void kbdLinuxDestroyPrivate(pointer priv)
{ {
if (priv) free(priv); free(priv);
} }
/** Ring the bell. /** Ring the bell.

View File

@ -301,7 +301,7 @@ pointer msLinuxCreatePrivate(DeviceIntPtr pMouse)
/** Destroy a private structure. */ /** Destroy a private structure. */
void msLinuxDestroyPrivate(pointer priv) void msLinuxDestroyPrivate(pointer priv)
{ {
if (priv) free(priv); free(priv);
} }
/** Fill the \a info structure with information needed to initialize \a /** Fill the \a info structure with information needed to initialize \a

View File

@ -269,7 +269,7 @@ pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
/** Destroy a private structure. */ /** Destroy a private structure. */
void ps2LinuxDestroyPrivate(pointer priv) void ps2LinuxDestroyPrivate(pointer priv)
{ {
if (priv) free(priv); free(priv);
} }
/** Fill the \a info structure with information needed to initialize \a /** Fill the \a info structure with information needed to initialize \a

View File

@ -377,5 +377,5 @@ pointer usbCreatePrivate(DeviceIntPtr pDevice)
/** Destroy a private structure. */ /** Destroy a private structure. */
void usbDestroyPrivate(pointer priv) void usbDestroyPrivate(pointer priv)
{ {
if (priv) free(priv); free(priv);
} }

View File

@ -168,7 +168,6 @@ fakeMapFramebuffer (KdScreenInfo *screen)
KdSetPointerMatrix (&m); KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2; 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); priv->base = malloc (priv->bytes_per_line * screen->height);

View File

@ -120,7 +120,6 @@ FreeList(const char ***list, int *lines)
int i; int i;
for (i = 0; i < *lines; i++) { for (i = 0; i < *lines; i++) {
if ((*list)[i])
free((*list)[i]); free((*list)[i]);
} }
free(*list); free(*list);

View File

@ -848,10 +848,10 @@ xf86ReconfigureLayout(void)
for (i = 0; i < MAXSCREENS; i++) { for (i = 0; i < MAXSCREENS; i++) {
xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i]; xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
/* we don't have to zero these, xf86InitOrigins() takes care of that */ /* we don't have to zero these, xf86InitOrigins() takes care of that */
if (sl->left) free(sl->left); free(sl->left);
if (sl->right) free(sl->right); free(sl->right);
if (sl->up) free(sl->up); free(sl->up);
if (sl->down) free(sl->down); free(sl->down);
} }
xf86InitOrigins(); xf86InitOrigins();

View File

@ -234,7 +234,6 @@ xf86DeleteScreen(int scrnIndex, int flags)
if (pScrn->drv) if (pScrn->drv)
pScrn->drv->refCount--; pScrn->drv->refCount--;
if (pScrn->privates)
free(pScrn->privates); free(pScrn->privates);
xf86ClearEntityListForScreen(scrnIndex); xf86ClearEntityListForScreen(scrnIndex);
@ -327,7 +326,6 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
/* This should *really* be handled in drv->UnInit(dev) call instead, but /* 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 * if the driver forgets about it make sure we free it or at least crash
* with flying colors */ * with flying colors */
if (pInp->private)
free(pInp->private); free(pInp->private);
FreeInputAttributes(pInp->attrs); FreeInputAttributes(pInp->attrs);
@ -2017,7 +2015,6 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
*/ */
pNewProp->next = NULL; pNewProp->next = NULL;
} else { } else {
if (pNewProp->name)
free(pNewProp->name); free(pNewProp->name);
existing = TRUE; existing = TRUE;
} }

View File

@ -844,9 +844,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
unwind: unwind:
if (is_auto && !xf86Info.autoAddDevices) if (is_auto && !xf86Info.autoAddDevices)
xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n"); xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
if(idev->driver)
free(idev->driver); free(idev->driver);
if(idev->identifier)
free(idev->identifier); free(idev->identifier);
xf86optionListFree(idev->commonOptions); xf86optionListFree(idev->commonOptions);
free(idev); free(idev);

View File

@ -327,7 +327,7 @@ CMapDestroyColormap (ColormapPtr cmap)
CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps; CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
if(pColPriv) { if(pColPriv) {
if(pColPriv->colors) free(pColPriv->colors); free(pColPriv->colors);
free(pColPriv); free(pColPriv);
} }

View File

@ -478,7 +478,6 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
instances[i].claimed = TRUE; instances[i].claimed = TRUE;
instances[i].dev = dev; instances[i].dev = dev;
} }
if (promPath)
free(promPath); free(promPath);
} }

View File

@ -1102,7 +1102,6 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
status = VidModeCheckModeForDriver(stuff->screen, modetmp); status = VidModeCheckModeForDriver(stuff->screen, modetmp);
status_reply: status_reply:
if(modetmp)
free(modetmp); free(modetmp);
rep.type = X_Reply; rep.type = X_Reply;

View File

@ -578,9 +578,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) { drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) {
DRIDrvMsg(pScreen->myNum, X_ERROR, DRIDrvMsg(pScreen->myNum, X_ERROR,
"[drm] failed to setup DRM signal handler\n"); "[drm] failed to setup DRM signal handler\n");
if (pDRIPriv->hiddenContextStore)
free(pDRIPriv->hiddenContextStore); free(pDRIPriv->hiddenContextStore);
if (pDRIPriv->partial3DContextStore)
free(pDRIPriv->partial3DContextStore); free(pDRIPriv->partial3DContextStore);
DRIDestroyContextPriv(pDRIContextPriv); DRIDestroyContextPriv(pDRIContextPriv);
return FALSE; return FALSE;
@ -1618,7 +1616,7 @@ DRICreateInfoRec(void)
void void
DRIDestroyInfoRec(DRIInfoPtr DRIInfo) DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
{ {
if (DRIInfo->busIdString) free(DRIInfo->busIdString); free(DRIInfo->busIdString);
free((char*)DRIInfo); free((char*)DRIInfo);
} }

View File

@ -378,9 +378,7 @@ tsort(void)
if (n == NULL) if (n == NULL)
ErrorF("tsort: internal error -- could not find cycle"); ErrorF("tsort: internal error -- could not find cycle");
} }
if (cycle_buf)
free(cycle_buf); free(cycle_buf);
if (longest_cycle)
free(longest_cycle); free(longest_cycle);
if (graph) if (graph)
free_nodes(graph); free_nodes(graph);

View File

@ -315,7 +315,6 @@ InitSubdirs(const char **subdirlist)
if (**s == '/' || **s == '\\' || strchr(*s, ':') || if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
strstr(*s, "..")) { strstr(*s, "..")) {
xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s); xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
if (tmp_subdirlist)
free(tmp_subdirlist); free(tmp_subdirlist);
return NULL; return NULL;
} }
@ -323,7 +322,6 @@ InitSubdirs(const char **subdirlist)
} }
subdirs = malloc((i * 2 + 1) * sizeof(char *)); subdirs = malloc((i * 2 + 1) * sizeof(char *));
if (!subdirs) { if (!subdirs) {
if (tmp_subdirlist)
free(tmp_subdirlist); free(tmp_subdirlist);
return NULL; return NULL;
} }
@ -348,7 +346,6 @@ InitSubdirs(const char **subdirlist)
while (--i >= 0) while (--i >= 0)
free(subdirs[i]); free(subdirs[i]);
free(subdirs); free(subdirs);
if (tmp_subdirlist)
free(tmp_subdirlist); free(tmp_subdirlist);
return NULL; return NULL;
} }
@ -367,7 +364,6 @@ InitSubdirs(const char **subdirlist)
} }
subdirs[i] = NULL; subdirs[i] = NULL;
} }
if (tmp_subdirlist)
free(tmp_subdirlist); free(tmp_subdirlist);
return (const char **)subdirs; return (const char **)subdirs;
} }

View File

@ -157,7 +157,6 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
xf86_config->num_crtc--; xf86_config->num_crtc--;
break; break;
} }
if (crtc->params)
free(crtc->params); free(crtc->params);
free(crtc->gamma_red); free(crtc->gamma_red);
free(crtc); free(crtc);
@ -382,7 +381,6 @@ done:
crtc->transformPresent = saved_transform_present; crtc->transformPresent = saved_transform_present;
} }
if (adjusted_mode->name)
free(adjusted_mode->name); free(adjusted_mode->name);
free(adjusted_mode); free(adjusted_mode);
@ -482,7 +480,6 @@ xf86OutputSetMonitor (xf86OutputPtr output)
if (!output->name) if (!output->name)
return; return;
if (output->options)
free(output->options); free(output->options);
output->options = xnfalloc (sizeof (xf86OutputOptions)); output->options = xnfalloc (sizeof (xf86OutputOptions));

View File

@ -103,7 +103,6 @@ xf86_dga_get_modes (ScreenPtr pScreen)
if (display_mode == scrn->modes) if (display_mode == scrn->modes)
break; break;
} }
if (xf86_config->dga_modes)
free(xf86_config->dga_modes); free(xf86_config->dga_modes);
xf86_config->dga_nmode = num; xf86_config->dga_nmode = num;
xf86_config->dga_modes = modes; xf86_config->dga_modes = modes;

View File

@ -405,7 +405,6 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
*/ */
xf86RotateDestroy (crtc); xf86RotateDestroy (crtc);
crtc->transform_in_use = FALSE; crtc->transform_in_use = FALSE;
if (new_params)
free(new_params); free(new_params);
new_params = NULL; new_params = NULL;
new_nparams = 0; new_nparams = 0;
@ -506,7 +505,6 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
crtc->crtc_to_framebuffer = crtc_to_fb; crtc->crtc_to_framebuffer = crtc_to_fb;
crtc->f_crtc_to_framebuffer = f_crtc_to_fb; crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
crtc->f_framebuffer_to_crtc = f_fb_to_crtc; crtc->f_framebuffer_to_crtc = f_fb_to_crtc;
if (crtc->params)
free(crtc->params); free(crtc->params);
crtc->params = new_params; crtc->params = new_params;
crtc->nparams = new_nparams; crtc->nparams = new_nparams;

View File

@ -451,7 +451,6 @@ xf86parseOption(XF86OptionPtr head)
if ((token = xf86getSubToken(&comment)) != STRING) { if ((token = xf86getSubToken(&comment)) != STRING) {
xf86parseError(BAD_OPTION_MSG, NULL); xf86parseError(BAD_OPTION_MSG, NULL);
if (comment)
free(comment); free(comment);
return (head); return (head);
} }

View File

@ -923,7 +923,6 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
if (!found) { if (!found) {
free(dirpath); free(dirpath);
dirpath = NULL; dirpath = NULL;
if (list)
free(list); free(list);
} }
} }
@ -1088,7 +1087,6 @@ xf86validationError (char *format,...)
void void
xf86setSection (char *section) xf86setSection (char *section)
{ {
if (configSection)
free(configSection); free(configSection);
configSection = malloc(strlen (section) + 1); configSection = malloc(strlen (section) + 1);
strcpy (configSection, section); strcpy (configSection, section);

View File

@ -132,11 +132,9 @@ RamDacFreeRec(ScrnInfoPtr pScrn)
ramdacScrPtr = ((RamDacScreenRecPtr) ramdacScrPtr = ((RamDacScreenRecPtr)
(pScrn)->privates[RamDacGetScreenIndex()].ptr); (pScrn)->privates[RamDacGetScreenIndex()].ptr);
if (ramdacHWPtr)
free(ramdacHWPtr); free(ramdacHWPtr);
ramdacHWPtr = NULL; ramdacHWPtr = NULL;
if (ramdacScrPtr)
free(ramdacScrPtr); free(ramdacScrPtr);
ramdacScrPtr = NULL; ramdacScrPtr = NULL;
} }

View File

@ -1479,7 +1479,6 @@ vgaHWGetHWRecPrivate(void)
static void static void
vgaHWFreeRegs(vgaRegPtr regp) vgaHWFreeRegs(vgaRegPtr regp)
{ {
if (regp->CRTC)
free(regp->CRTC); free(regp->CRTC);
regp->CRTC = regp->CRTC =

View File

@ -148,8 +148,8 @@ XAADoBitBlt(
pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox); pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
if(!pboxNew2 || !pptNew2) { if(!pboxNew2 || !pptNew2) {
if (pptNew2) free(pptNew2); free(pptNew2);
if (pboxNew2) free(pboxNew2); free(pboxNew2);
if (pboxNew1) { if (pboxNew1) {
free(pptNew1); free(pptNew1);
free(pboxNew1); free(pboxNew1);

View File

@ -243,7 +243,6 @@ XAADestroyGC(GCPtr pGC)
if(pGCPriv->XAAOps != &XAAFallbackOps) if(pGCPriv->XAAOps != &XAAFallbackOps)
free(pGCPriv->XAAOps); free(pGCPriv->XAAOps);
if(pGCPriv->DashPattern)
free(pGCPriv->DashPattern); free(pGCPriv->DashPattern);
(*pGC->funcs->DestroyGC)(pGC); (*pGC->funcs->DestroyGC)(pGC);

View File

@ -84,10 +84,8 @@ XAADestroyInfoRec(XAAInfoRecPtr infoRec)
if(infoRec->ClosePixmapCache) if(infoRec->ClosePixmapCache)
(*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen); (*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); free(infoRec);

View File

@ -74,7 +74,6 @@ XAAComputeDash(GCPtr pGC)
int shift, value, direction; int shift, value, direction;
Bool set; Bool set;
if(pGCPriv->DashPattern)
free(pGCPriv->DashPattern); free(pGCPriv->DashPattern);
pGCPriv->DashPattern = NULL; pGCPriv->DashPattern = NULL;

View File

@ -144,17 +144,11 @@ FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
{ {
if(!pPriv) return; if(!pPriv) return;
if(pPriv->Info512)
free(pPriv->Info512); free(pPriv->Info512);
if(pPriv->Info256)
free(pPriv->Info256); free(pPriv->Info256);
if(pPriv->Info128)
free(pPriv->Info128); free(pPriv->Info128);
if(pPriv->InfoColor)
free(pPriv->InfoColor); free(pPriv->InfoColor);
if(pPriv->InfoMono)
free(pPriv->InfoMono); free(pPriv->InfoMono);
if(pPriv->InfoPartial)
free(pPriv->InfoPartial); free(pPriv->InfoPartial);
free(pPriv); free(pPriv);

View File

@ -299,7 +299,6 @@ XAAGlyphBltTEColorExpansion(
skippix, ytop - Top, glyphs + skipglyphs, glyphWidth, skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
fg, bg, rop, planemask); fg, bg, rop, planemask);
if (fallbackBits)
free(fallbackBits); free(fallbackBits);
} }

View File

@ -214,7 +214,6 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
free(icws.cmapIDs); free(icws.cmapIDs);
if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) { if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
if (xnestOldInstalledColormapWindows)
free(xnestOldInstalledColormapWindows); free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64 #ifdef _XSERVER64
@ -264,13 +263,12 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
#endif /* DUMB_WINDOW_MANAGERS */ #endif /* DUMB_WINDOW_MANAGERS */
} }
else else
if (icws.windows) free(icws.windows); free(icws.windows);
} }
void void
xnestSetScreenSaverColormapWindow(ScreenPtr pScreen) xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
{ {
if (xnestOldInstalledColormapWindows)
free(xnestOldInstalledColormapWindows); free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64 #ifdef _XSERVER64

View File

@ -411,7 +411,6 @@ winClipboardFlushXEvents (HWND hwnd,
xtpText.value = NULL; xtpText.value = NULL;
xtpText.nitems = 0; xtpText.nitems = 0;
} }
if (pszConvertData)
free(pszConvertData); free(pszConvertData);
if (hGlobal && pszGlobalData) if (hGlobal && pszGlobalData)
GlobalUnlock (hGlobal); GlobalUnlock (hGlobal);
@ -773,9 +772,7 @@ winClipboardFlushXEvents (HWND hwnd,
xtpText.value = NULL; xtpText.value = NULL;
xtpText.nitems = 0; xtpText.nitems = 0;
} }
if (pszConvertData)
free(pszConvertData); free(pszConvertData);
if (pwszUnicodeStr)
free(pwszUnicodeStr); free(pwszUnicodeStr);
if (hGlobal && pszGlobalData) if (hGlobal && pszGlobalData)
GlobalUnlock (hGlobal); GlobalUnlock (hGlobal);

View File

@ -144,9 +144,7 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
MB_OK | uType); MB_OK | uType);
winMessageBoxF_Cleanup: winMessageBoxF_Cleanup:
if (pszErrorF)
free(pszErrorF); free(pszErrorF);
if (pszMsgBox)
free(pszMsgBox); free(pszMsgBox);
#undef MESSAGEBOXF #undef MESSAGEBOXF
} }

View File

@ -672,7 +672,6 @@ winOverrideIcon (unsigned long longWin)
{ {
free (res_name); free (res_name);
free (res_class); free (res_class);
if (wmName)
free(wmName); free(wmName);
if (pref.icon[i].hicon) if (pref.icon[i].hicon)
@ -691,7 +690,6 @@ winOverrideIcon (unsigned long longWin)
/* Didn't find the icon, fail gracefully */ /* Didn't find the icon, fail gracefully */
free (res_name); free (res_name);
free (res_class); free (res_class);
if (wmName)
free(wmName); free(wmName);
return 0; return 0;
@ -849,7 +847,6 @@ winOverrideStyle (unsigned long longpWin)
{ {
free (res_name); free (res_name);
free (res_class); free (res_class);
if (wmName)
free(wmName); free(wmName);
if (pref.style[i].type) if (pref.style[i].type)
@ -860,7 +857,6 @@ winOverrideStyle (unsigned long longpWin)
/* Didn't find the style, fail gracefully */ /* Didn't find the style, fail gracefully */
free (res_name); free (res_name);
free (res_class); free (res_class);
if (wmName)
free(wmName); free(wmName);
return STYLE_NONE; return STYLE_NONE;

View File

@ -3081,9 +3081,7 @@ fillSpans (
(*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE); (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
} }
disposeFinalSpans (); disposeFinalSpans ();
if (xSpans)
free(xSpans); free(xSpans);
if (xWidths)
free(xWidths); free(xWidths);
finalMiny = 0; finalMiny = 0;
finalMaxy = -1; finalMaxy = -1;

View File

@ -150,11 +150,8 @@ miCopyArea(DrawablePtr pSrcDrawable,
ordering = malloc(numRects * sizeof(unsigned int)); ordering = malloc(numRects * sizeof(unsigned int));
if(!pptFirst || !pwidthFirst || !ordering) if(!pptFirst || !pwidthFirst || !ordering)
{ {
if (ordering)
free(ordering); free(ordering);
if (pwidthFirst)
free(pwidthFirst); free(pwidthFirst);
if (pptFirst)
free(pptFirst); free(pptFirst);
return NULL; return NULL;
} }
@ -433,8 +430,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
pwidth = pwidthFirst = malloc(h * sizeof(int)); pwidth = pwidthFirst = malloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) free(pwidthFirst); free(pwidthFirst);
if (pptFirst) free(pptFirst); free(pptFirst);
FreeScratchGC(pGCT); FreeScratchGC(pGCT);
return; return;
} }
@ -801,9 +798,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
pwidth = pwidthFirst = malloc(h * sizeof(int)); pwidth = pwidthFirst = malloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst)
free(pwidthFirst); free(pwidthFirst);
if (pptFirst)
free(pptFirst); free(pptFirst);
return; return;
} }

View File

@ -108,7 +108,6 @@ miCopyRegion (DrawablePtr pSrcDrawable,
pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
if(!pboxNew2) if(!pboxNew2)
{ {
if (pboxNew1)
free(pboxNew1); free(pboxNew1);
return; return;
} }
@ -143,9 +142,7 @@ miCopyRegion (DrawablePtr pSrcDrawable,
dx, dy, dx, dy,
reverse, upsidedown, bitPlane, closure); reverse, upsidedown, bitPlane, closure);
if (pboxNew1)
free(pboxNew1); free(pboxNew1);
if (pboxNew2)
free(pboxNew2); free(pboxNew2);
} }

View File

@ -111,8 +111,8 @@ miPolyFillRect(
pwFirst = malloc(maxheight * sizeof(int)); pwFirst = malloc(maxheight * sizeof(int));
if(!pptFirst || !pwFirst) if(!pptFirst || !pwFirst)
{ {
if (pwFirst) free(pwFirst); free(pwFirst);
if (pptFirst) free(pptFirst); free(pptFirst);
return; return;
} }

View File

@ -122,9 +122,9 @@ miFillSppPoly(
if(!ptsOut || !width || !Marked) if(!ptsOut || !width || !Marked)
{ {
if (Marked) free(Marked); free(Marked);
if (width) free(width); free(width);
if (ptsOut) free(ptsOut); free(ptsOut);
return; return;
} }

View File

@ -109,8 +109,8 @@ miFillConvexPoly(
width = FirstWidth = malloc(sizeof(int) * dy); width = FirstWidth = malloc(sizeof(int) * dy);
if(!FirstPoint || !FirstWidth) if(!FirstPoint || !FirstWidth)
{ {
if (FirstWidth) free(FirstWidth); free(FirstWidth);
if (FirstPoint) free(FirstPoint); free(FirstPoint);
return(FALSE); return(FALSE);
} }

View File

@ -410,9 +410,7 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
if (!yspans || !ysizes) if (!yspans || !ysizes)
{ {
if (yspans)
free(yspans); free(yspans);
if (ysizes)
free(ysizes); free(ysizes);
miDisposeSpanGroup (spanGroup); miDisposeSpanGroup (spanGroup);
return; return;
@ -492,9 +490,7 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
} }
free(yspans); free(yspans);
free(ysizes); free(ysizes);
if (points)
free(points); free(points);
if (widths)
free(widths); free(widths);
return; return;
} }

View File

@ -190,7 +190,6 @@ RRCrtcNotify (RRCrtcPtr crtc,
} }
else else
{ {
if (crtc->outputs)
free(crtc->outputs); free(crtc->outputs);
newoutputs = NULL; newoutputs = NULL;
} }
@ -440,7 +439,6 @@ RRCrtcDestroyResource (pointer value, XID pid)
} }
} }
} }
if (crtc->gammaRed)
free(crtc->gammaRed); free(crtc->gammaRed);
if (crtc->mode) if (crtc->mode)
RRModeDestroy (crtc->mode); RRModeDestroy (crtc->mode);
@ -563,7 +561,6 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
} }
else else
gamma = NULL; gamma = NULL;
if (crtc->gammaRed)
free(crtc->gammaRed); free(crtc->gammaRed);
crtc->gammaRed = gamma; crtc->gammaRed = gamma;
crtc->gammaGreen = gamma + size; crtc->gammaGreen = gamma + size;
@ -805,7 +802,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
RROutputType, client, DixSetAttrAccess); RROutputType, client, DixSetAttrAccess);
if (rc != Success) if (rc != Success)
{ {
if (outputs)
free(outputs); free(outputs);
return rc; return rc;
} }
@ -815,7 +811,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
break; break;
if (j == outputs[i]->numCrtcs) if (j == outputs[i]->numCrtcs)
{ {
if (outputs)
free(outputs); free(outputs);
return BadMatch; return BadMatch;
} }
@ -830,7 +825,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
} }
if (j == outputs[i]->numModes + outputs[i]->numUserModes) if (j == outputs[i]->numModes + outputs[i]->numUserModes)
{ {
if (outputs)
free(outputs); free(outputs);
return BadMatch; return BadMatch;
} }
@ -850,7 +844,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
} }
if (k == outputs[i]->numClones) if (k == outputs[i]->numClones)
{ {
if (outputs)
free(outputs); free(outputs);
return BadMatch; return BadMatch;
} }
@ -900,7 +893,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
* Invalid rotation * Invalid rotation
*/ */
client->errorValue = stuff->rotation; client->errorValue = stuff->rotation;
if (outputs)
free(outputs); free(outputs);
return BadValue; return BadValue;
} }
@ -913,7 +905,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
* requested rotation or reflection not supported by screen * requested rotation or reflection not supported by screen
*/ */
client->errorValue = stuff->rotation; client->errorValue = stuff->rotation;
if (outputs)
free(outputs); free(outputs);
return BadMatch; return BadMatch;
} }
@ -943,7 +934,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
if (stuff->x + source_width > pScreen->width) if (stuff->x + source_width > pScreen->width)
{ {
client->errorValue = stuff->x; client->errorValue = stuff->x;
if (outputs)
free(outputs); free(outputs);
return BadValue; return BadValue;
} }
@ -951,7 +941,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
if (stuff->y + source_height > pScreen->height) if (stuff->y + source_height > pScreen->height)
{ {
client->errorValue = stuff->y; client->errorValue = stuff->y;
if (outputs)
free(outputs); free(outputs);
return BadValue; return BadValue;
} }
@ -979,7 +968,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
pScrPriv->lastSetTime = time; pScrPriv->lastSetTime = time;
sendReply: sendReply:
if (outputs)
free(outputs); free(outputs);
rep.type = X_Reply; rep.type = X_Reply;

View File

@ -134,7 +134,6 @@ RROutputSetClones (RROutputPtr output,
} }
else else
newClones = NULL; newClones = NULL;
if (output->clones)
free(output->clones); free(output->clones);
memcpy (newClones, clones, numClones * sizeof (RROutputPtr)); memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
output->clones = newClones; output->clones = newClones;
@ -280,7 +279,6 @@ RROutputSetCrtcs (RROutputPtr output,
} }
else else
newCrtcs = NULL; newCrtcs = NULL;
if (output->crtcs)
free(output->crtcs); free(output->crtcs);
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr)); memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
output->crtcs = newCrtcs; output->crtcs = newCrtcs;
@ -402,12 +400,9 @@ RROutputDestroyResource (pointer value, XID pid)
for (m = 0; m < output->numUserModes; m++) for (m = 0; m < output->numUserModes; m++)
RRModeDestroy (output->userModes[m]); RRModeDestroy (output->userModes[m]);
if (output->userModes)
free(output->userModes); free(output->userModes);
if (output->crtcs)
free(output->crtcs); free(output->crtcs);
if (output->clones)
free(output->clones); free(output->clones);
RRDeleteAllOutputProperties (output); RRDeleteAllOutputProperties (output);
free(output); free(output);

View File

@ -69,9 +69,7 @@ RRDeleteAllOutputProperties (RROutputPtr output)
event.atom = prop->propertyName; event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds; event.timestamp = currentTime.milliseconds;
RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event); RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
if (prop->current.data)
free(prop->current.data); free(prop->current.data);
if (prop->pending.data)
free(prop->pending.data); free(prop->pending.data);
free(prop); free(prop);
} }
@ -109,13 +107,9 @@ RRCreateOutputProperty (Atom property)
static void static void
RRDestroyOutputProperty (RRPropertyPtr prop) RRDestroyOutputProperty (RRPropertyPtr prop)
{ {
if (prop->valid_values)
free(prop->valid_values); free(prop->valid_values);
if (prop->current.data)
free(prop->current.data); free(prop->current.data);
if (prop->pending.data)
free(prop->pending.data); free(prop->pending.data);
if (prop->valid_values)
free(prop->valid_values); free(prop->valid_values);
free(prop); free(prop);
} }
@ -232,11 +226,9 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
!pScrPriv->rrOutputSetProperty(output->pScreen, output, !pScrPriv->rrOutputSetProperty(output->pScreen, output,
prop->propertyName, &new_value)) prop->propertyName, &new_value))
{ {
if (new_value.data)
free(new_value.data); free(new_value.data);
return (BadValue); return (BadValue);
} }
if (prop_value->data)
free(prop_value->data); free(prop_value->data);
*prop_value = new_value; *prop_value = new_value;
} }
@ -378,7 +370,6 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
*/ */
if (prop->is_pending && !pending) if (prop->is_pending && !pending)
{ {
if (prop->pending.data)
free(prop->pending.data); free(prop->pending.data);
RRInitOutputPropertyValue (&prop->pending); RRInitOutputPropertyValue (&prop->pending);
} }
@ -387,7 +378,6 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
prop->range = range; prop->range = range;
prop->immutable = immutable; prop->immutable = immutable;
prop->num_valid = num_values; prop->num_valid = num_values;
if (prop->valid_values)
free(prop->valid_values); free(prop->valid_values);
prop->valid_values = new_values; prop->valid_values = new_values;

View File

@ -951,7 +951,6 @@ ProcRRSetScreenConfig (ClientPtr client)
sendReply: sendReply:
if (pData)
free(pData); free(pData);
rep.type = X_Reply; rep.type = X_Reply;

View File

@ -37,7 +37,6 @@ RRTransformInit (RRTransformPtr transform)
void void
RRTransformFini (RRTransformPtr transform) RRTransformFini (RRTransformPtr transform)
{ {
if (transform->params)
free(transform->params); free(transform->params);
} }
@ -82,7 +81,6 @@ RRTransformSetFilter (RRTransformPtr dst,
} }
else else
new_params = NULL; new_params = NULL;
if (dst->params)
free(dst->params); free(dst->params);
dst->filter = filter; dst->filter = filter;
dst->params = new_params; dst->params = new_params;

View File

@ -1868,7 +1868,6 @@ bailout:
if (si) if (si)
{ {
for (i = 0; i < maxSets; i++) for (i = 0; i < maxSets; i++)
if (si[i].intervals)
free(si[i].intervals); free(si[i].intervals);
free(si); free(si);
} }
@ -1955,7 +1954,6 @@ ProcRecordCreateContext(ClientPtr client)
err = BadAlloc; err = BadAlloc;
} }
bailout: bailout:
if (pContext)
free(pContext); free(pContext);
return err; return err;
} /* ProcRecordCreateContext */ } /* ProcRecordCreateContext */
@ -2352,7 +2350,7 @@ ProcRecordGetContext(ClientPtr client)
bailout: bailout:
for (i = 0; i < nRCAPs; i++) for (i = 0; i < nRCAPs; i++)
{ {
if (pRangeInfo[i].pRanges) free(pRangeInfo[i].pRanges); free(pRangeInfo[i].pRanges);
} }
free(pRangeInfo); free(pRangeInfo);
return err; return err;

View File

@ -360,7 +360,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
prls->nIntervals = nIntervals; prls->nIntervals = nIntervals;
bailout: bailout:
if (stackIntervals) free(stackIntervals); free(stackIntervals);
return (RecordSetPtr)prls; return (RecordSetPtr)prls;
} }

View File

@ -1524,7 +1524,6 @@ FreePicture (pointer value,
if (--pPicture->refcnt == 0) if (--pPicture->refcnt == 0)
{ {
if (pPicture->transform)
free(pPicture->transform); free(pPicture->transform);
if (pPicture->pSourcePict) if (pPicture->pSourcePict)

View File

@ -183,7 +183,6 @@ _XkbClearColor(char *color_in)
{ {
XkbColorPtr color= (XkbColorPtr)color_in; XkbColorPtr color= (XkbColorPtr)color_in;
if (color->spec)
free(color->spec); free(color->spec);
return; return;
} }
@ -663,7 +662,6 @@ register XkbPropertyPtr prop;
return NULL; return NULL;
for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
if ((prop->name)&&(strcmp(name,prop->name)==0)) { if ((prop->name)&&(strcmp(name,prop->name)==0)) {
if (prop->value)
free(prop->value); free(prop->value);
prop->value= malloc(strlen(value)+1); prop->value= malloc(strlen(value)+1);
if (prop->value) if (prop->value)

View File

@ -312,7 +312,6 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
if ((map_count>type->map_count)||(type->map==NULL)) if ((map_count>type->map_count)||(type->map==NULL))
type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec)); type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec));
if (!type->map) { if (!type->map) {
if (prev_map)
free(prev_map); free(prev_map);
return BadAlloc; return BadAlloc;
} }
@ -324,7 +323,6 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
map_count * sizeof(XkbModsRec)); map_count * sizeof(XkbModsRec));
} }
if (!type->preserve) { if (!type->preserve) {
if (prev_preserve)
free(prev_preserve); free(prev_preserve);
return BadAlloc; return BadAlloc;
} }
@ -342,7 +340,6 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
type->level_names = realloc(type->level_names, type->level_names = realloc(type->level_names,
new_num_lvls * sizeof(Atom)); new_num_lvls * sizeof(Atom));
if (!type->level_names) { if (!type->level_names) {
if (prev_level_names)
free(prev_level_names); free(prev_level_names);
return BadAlloc; return BadAlloc;
} }

View File

@ -553,9 +553,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
static void static void
FreeMultiDefs(XkbRF_MultiDefsPtr defs) FreeMultiDefs(XkbRF_MultiDefsPtr defs)
{ {
if (defs->options) free(defs->options); free(defs->options);
if (defs->layout[1]) free(defs->layout[1]); free(defs->layout[1]);
if (defs->variant[1]) free(defs->variant[1]); free(defs->variant[1]);
} }
static void static void
@ -988,15 +988,15 @@ XkbRF_GroupPtr group;
return; return;
if (rules->rules) { if (rules->rules) {
for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) { for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
if (rule->model) free(rule->model); free(rule->model);
if (rule->layout) free(rule->layout); free(rule->layout);
if (rule->variant) free(rule->variant); free(rule->variant);
if (rule->option) free(rule->option); free(rule->option);
if (rule->keycodes) free(rule->keycodes); free(rule->keycodes);
if (rule->symbols) free(rule->symbols); free(rule->symbols);
if (rule->types) free(rule->types); free(rule->types);
if (rule->compat) free(rule->compat); free(rule->compat);
if (rule->geometry) free(rule->geometry); free(rule->geometry);
memset((char *)rule, 0, sizeof(XkbRF_RuleRec)); memset((char *)rule, 0, sizeof(XkbRF_RuleRec));
} }
free(rules->rules); free(rules->rules);
@ -1006,8 +1006,8 @@ XkbRF_GroupPtr group;
if (rules->groups) { if (rules->groups) {
for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) { for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
if (group->name) free(group->name); free(group->name);
if (group->words) free(group->words); free(group->words);
} }
free(rules->groups); free(rules->groups);
rules->num_groups= 0; rules->num_groups= 0;

View File

@ -220,19 +220,14 @@ char * pval;
static void static void
XkbSetRulesUsed(XkbRMLVOSet *rmlvo) XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
{ {
if (XkbRulesUsed)
free(XkbRulesUsed); free(XkbRulesUsed);
XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL); XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL);
if (XkbModelUsed)
free(XkbModelUsed); free(XkbModelUsed);
XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL); XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL);
if (XkbLayoutUsed)
free(XkbLayoutUsed); free(XkbLayoutUsed);
XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL); XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL);
if (XkbVariantUsed)
free(XkbVariantUsed); free(XkbVariantUsed);
XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL); XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL);
if (XkbOptionsUsed)
free(XkbOptionsUsed); free(XkbOptionsUsed);
XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL); XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL);
if (XkbWantRulesProp) if (XkbWantRulesProp)
@ -244,27 +239,22 @@ void
XkbSetRulesDflts(XkbRMLVOSet *rmlvo) XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
{ {
if (rmlvo->rules) { if (rmlvo->rules) {
if (XkbRulesDflt)
free(XkbRulesDflt); free(XkbRulesDflt);
XkbRulesDflt= _XkbDupString(rmlvo->rules); XkbRulesDflt= _XkbDupString(rmlvo->rules);
} }
if (rmlvo->model) { if (rmlvo->model) {
if (XkbModelDflt)
free(XkbModelDflt); free(XkbModelDflt);
XkbModelDflt= _XkbDupString(rmlvo->model); XkbModelDflt= _XkbDupString(rmlvo->model);
} }
if (rmlvo->layout) { if (rmlvo->layout) {
if (XkbLayoutDflt)
free(XkbLayoutDflt); free(XkbLayoutDflt);
XkbLayoutDflt= _XkbDupString(rmlvo->layout); XkbLayoutDflt= _XkbDupString(rmlvo->layout);
} }
if (rmlvo->variant) { if (rmlvo->variant) {
if (XkbVariantDflt)
free(XkbVariantDflt); free(XkbVariantDflt);
XkbVariantDflt= _XkbDupString(rmlvo->variant); XkbVariantDflt= _XkbDupString(rmlvo->variant);
} }
if (rmlvo->options) { if (rmlvo->options) {
if (XkbOptionsDflt)
free(XkbOptionsDflt); free(XkbOptionsDflt);
XkbOptionsDflt= _XkbDupString(rmlvo->options); XkbOptionsDflt= _XkbDupString(rmlvo->options);
} }

View File

@ -605,8 +605,8 @@ void
XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli) XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli)
{ {
if ((sli->flags&XkbSLI_IsDefault)==0) { if ((sli->flags&XkbSLI_IsDefault)==0) {
if (sli->maps) free(sli->maps); free(sli->maps);
if (sli->names) free(sli->names); free(sli->names);
} }
sli->maps= NULL; sli->maps= NULL;
sli->names= NULL; sli->names= NULL;