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,8 +1276,7 @@ XineramaGetImageData(
} }
if(ScratchMem) free(ScratchMem);
free(ScratchMem);
RegionUninit(&SrcRegion); RegionUninit(&SrcRegion);
RegionUninit(&GrabRegion); RegionUninit(&GrabRegion);

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,8 +259,7 @@ 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,8 +326,7 @@ 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,8 +442,7 @@ 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,8 +153,7 @@ 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,8 +622,7 @@ 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,8 +797,7 @@ 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,8 +806,7 @@ 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,10 +184,8 @@ unwind:
while (options) { while (options) {
tmpo = options; tmpo = options;
options = options->next; options = options->next;
if (tmpo->key) free(tmpo->key);
free(tmpo->key); free(tmpo->value);
if (tmpo->value)
free(tmpo->value);
free(tmpo); free(tmpo);
} }

View File

@ -251,28 +251,23 @@ 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);
} }
} else } else
@ -289,8 +284,7 @@ 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,22 +360,17 @@ 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);
} }
unwind: unwind:
if (set) if (set)
libhal_free_property_set(set); libhal_free_property_set(set);
if (path) free(path);
free(path); free(driver);
if (driver) free(name);
free(driver); free(config_info);
if (name)
free(name);
if (config_info)
free(config_info);
while (!dev && (tmpo = options)) { while (!dev && (tmpo = options)) {
options = tmpo->next; options = tmpo->next;
free(tmpo->key); free(tmpo->key);
@ -401,16 +390,11 @@ unwind:
free(attrs.tags); free(attrs.tags);
} }
if (xkb_opts.layout) free(xkb_opts.layout);
free(xkb_opts.layout); free(xkb_opts.rules);
if (xkb_opts.rules) free(xkb_opts.model);
free(xkb_opts.rules); free(xkb_opts.variant);
if (xkb_opts.model) free(xkb_opts.options);
free(xkb_opts.model);
if (xkb_opts.variant)
free(xkb_opts.variant);
if (xkb_opts.options)
free(xkb_opts.options);
dbus_error_free(&error); dbus_error_free(&error);

View File

@ -693,10 +693,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
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,8 +740,7 @@ 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,8 +748,7 @@ 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,10 +1463,8 @@ 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); free(feedc->ctrl.symbols_displayed);
if (feedc->ctrl.symbols_displayed)
free(feedc->ctrl.symbols_displayed);
free(feedc); free(feedc);
return FALSE; return FALSE;
} }
@ -2283,8 +2279,7 @@ 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,8 +731,7 @@ 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)
memmove(c->savedName, name, namelen + 1); memmove(c->savedName, name, namelen + 1);
@ -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,8 +993,7 @@ 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)
memmove(c->savedName, name, namelen + 1); memmove(c->savedName, name, namelen + 1);
@ -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,10 +3793,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
} }
unwind: unwind:
if (xE) free(xE);
free(xE); free(xi2);
if (xi2)
free(xi2);
return; return;
} }
@ -3976,10 +3974,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
} }
} }
if (xi) free(xi);
free(xi); free(xi2);
if (xi2)
free(xi2);
} }
/* This function is used to set the key pressed or key released state - /* This function is used to set the key pressed or key released state -

View File

@ -327,8 +327,7 @@ 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)
return; return;

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,8 +762,7 @@ 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,8 +257,7 @@ 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,8 +2431,7 @@ 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,10 +272,8 @@ 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); free(s1);
if (s1)
free(s1);
return NULL; return NULL;
} }
combo_string[0] = '\0'; combo_string[0] = '\0';

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,8 +531,7 @@ 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;
return TRUE; return TRUE;

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,8 +168,7 @@ 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);
if (scrpriv->shadow) if (scrpriv->shadow)

View File

@ -120,8 +120,7 @@ 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);
*list = NULL; *list = NULL;

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,8 +234,7 @@ 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,8 +326,7 @@ 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,8 +2015,7 @@ 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,10 +844,8 @@ 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); free(idev->identifier);
if(idev->identifier)
free(idev->identifier);
xf86optionListFree(idev->commonOptions); xf86optionListFree(idev->commonOptions);
free(idev); free(idev);
return rval; return rval;

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,8 +478,7 @@ 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);
} }
DebugF("%s instances found: %d\n", driverName, numClaimedInstances); DebugF("%s instances found: %d\n", driverName, numClaimedInstances);

View File

@ -1102,8 +1102,7 @@ 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;
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply) rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)

View File

@ -578,10 +578,8 @@ 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); free(pDRIPriv->partial3DContextStore);
if (pDRIPriv->partial3DContextStore)
free(pDRIPriv->partial3DContextStore);
DRIDestroyContextPriv(pDRIContextPriv); DRIDestroyContextPriv(pDRIContextPriv);
return FALSE; return FALSE;
} else { } else {
@ -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,10 +378,8 @@ 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); free(longest_cycle);
if (longest_cycle)
free(longest_cycle);
if (graph) if (graph)
free_nodes(graph); free_nodes(graph);
} }

View File

@ -315,16 +315,14 @@ 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;
} }
} }
} }
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;
} }
i = 0; i = 0;
@ -348,8 +346,7 @@ 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;
} }
/* tack on the OS name */ /* tack on the OS name */
@ -367,8 +364,7 @@ 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,8 +157,7 @@ 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,8 +381,7 @@ 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);
if (didLock) if (didLock)
@ -482,8 +480,7 @@ 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));
memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions)); memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));

View File

@ -103,8 +103,7 @@ 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;
return TRUE; return TRUE;

View File

@ -405,8 +405,7 @@ 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;
new_filter = NULL; new_filter = NULL;
@ -506,8 +505,7 @@ 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;
crtc->filter = new_filter; crtc->filter = new_filter;

View File

@ -451,8 +451,7 @@ 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,8 +923,7 @@ 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,8 +1087,7 @@ 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,12 +132,10 @@ 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,8 +1479,7 @@ 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 =
regp->Sequencer = regp->Sequencer =

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,8 +243,7 @@ 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);
XAA_GC_FUNC_EPILOGUE (pGC); XAA_GC_FUNC_EPILOGUE (pGC);

View File

@ -84,11 +84,9 @@ 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,8 +74,7 @@ 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;
pGCPriv->DashLength = 0; pGCPriv->DashLength = 0;

View File

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

View File

@ -299,8 +299,7 @@ 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);
} }
nbox--; pbox++; nbox--; pbox++;

View File

@ -214,8 +214,7 @@ 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,14 +263,13 @@ 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,8 +411,7 @@ 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,10 +772,8 @@ winClipboardFlushXEvents (HWND hwnd,
xtpText.value = NULL; xtpText.value = NULL;
xtpText.nitems = 0; xtpText.nitems = 0;
} }
if (pszConvertData) free(pszConvertData);
free (pszConvertData); free(pwszUnicodeStr);
if (pwszUnicodeStr)
free (pwszUnicodeStr);
if (hGlobal && pszGlobalData) if (hGlobal && pszGlobalData)
GlobalUnlock (hGlobal); GlobalUnlock (hGlobal);
if (fSetClipboardData && g_fUnicodeSupport) if (fSetClipboardData && g_fUnicodeSupport)

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); free(pszMsgBox);
if (pszMsgBox)
free(pszMsgBox);
#undef MESSAGEBOXF #undef MESSAGEBOXF
} }

View File

@ -672,8 +672,7 @@ 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)
return pref.icon[i].hicon; return pref.icon[i].hicon;
@ -691,8 +690,7 @@ 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,8 +847,7 @@ 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)
return pref.style[i].type; return pref.style[i].type;
@ -860,8 +857,7 @@ 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,10 +3081,8 @@ 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); free(xWidths);
if (xWidths)
free(xWidths);
finalMiny = 0; finalMiny = 0;
finalMaxy = -1; finalMaxy = -1;
finalSize = 0; finalSize = 0;

View File

@ -150,12 +150,9 @@ 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); free(pwidthFirst);
if (pwidthFirst) free(pptFirst);
free(pwidthFirst);
if (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,10 +798,8 @@ 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); free(pptFirst);
if (pptFirst)
free(pptFirst);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)

View File

@ -108,8 +108,7 @@ 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;
} }
pboxBase = pboxNext = pbox; pboxBase = pboxNext = pbox;
@ -143,10 +142,8 @@ miCopyRegion (DrawablePtr pSrcDrawable,
dx, dy, dx, dy,
reverse, upsidedown, bitPlane, closure); reverse, upsidedown, bitPlane, closure);
if (pboxNew1) free(pboxNew1);
free(pboxNew1); free(pboxNew2);
if (pboxNew2)
free(pboxNew2);
} }
RegionPtr RegionPtr

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,10 +410,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
if (!yspans || !ysizes) if (!yspans || !ysizes)
{ {
if (yspans) free(yspans);
free(yspans); free(ysizes);
if (ysizes)
free(ysizes);
miDisposeSpanGroup (spanGroup); miDisposeSpanGroup (spanGroup);
return; return;
} }
@ -492,10 +490,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
} }
free(yspans); free(yspans);
free(ysizes); free(ysizes);
if (points) free(points);
free(points); free(widths);
if (widths)
free(widths);
return; return;
} }
count = 0; count = 0;

View File

@ -190,8 +190,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
} }
else else
{ {
if (crtc->outputs) free(crtc->outputs);
free(crtc->outputs);
newoutputs = NULL; newoutputs = NULL;
} }
crtc->outputs = newoutputs; crtc->outputs = newoutputs;
@ -440,8 +439,7 @@ 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);
free(crtc); free(crtc);
@ -563,8 +561,7 @@ 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;
crtc->gammaBlue = gamma + size*2; crtc->gammaBlue = gamma + size*2;
@ -805,8 +802,7 @@ 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;
} }
/* validate crtc for this output */ /* validate crtc for this output */
@ -815,8 +811,7 @@ 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;
} }
/* validate mode for this output */ /* validate mode for this output */
@ -830,8 +825,7 @@ 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,8 +844,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
} }
if (k == outputs[i]->numClones) if (k == outputs[i]->numClones)
{ {
if (outputs) free(outputs);
free(outputs);
return BadMatch; return BadMatch;
} }
} }
@ -900,8 +893,7 @@ 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,8 +905,7 @@ 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,16 +934,14 @@ 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;
} }
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,8 +968,7 @@ 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;
/* rep.status has already been filled in */ /* rep.status has already been filled in */

View File

@ -134,8 +134,7 @@ 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;
output->numClones = numClones; output->numClones = numClones;
@ -280,8 +279,7 @@ 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;
output->numCrtcs = numCrtcs; output->numCrtcs = numCrtcs;
@ -402,13 +400,10 @@ 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); free(output->clones);
if (output->clones)
free(output->clones);
RRDeleteAllOutputProperties (output); RRDeleteAllOutputProperties (output);
free(output); free(output);
return 1; return 1;

View File

@ -69,10 +69,8 @@ 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); free(prop->pending.data);
if (prop->pending.data)
free(prop->pending.data);
free(prop); free(prop);
} }
} }
@ -109,14 +107,10 @@ 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); free(prop->current.data);
if (prop->current.data) free(prop->pending.data);
free(prop->current.data); free(prop->valid_values);
if (prop->pending.data)
free(prop->pending.data);
if (prop->valid_values)
free(prop->valid_values);
free(prop); free(prop);
} }
@ -232,12 +226,10 @@ 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,8 +370,7 @@ 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,8 +378,7 @@ 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;
if (add) { if (add) {

View File

@ -951,8 +951,7 @@ ProcRRSetScreenConfig (ClientPtr client)
sendReply: sendReply:
if (pData) free(pData);
free(pData);
rep.type = X_Reply; rep.type = X_Reply;
/* rep.status has already been filled in */ /* rep.status has already been filled in */

View File

@ -37,8 +37,7 @@ RRTransformInit (RRTransformPtr transform)
void void
RRTransformFini (RRTransformPtr transform) RRTransformFini (RRTransformPtr transform)
{ {
if (transform->params) free(transform->params);
free(transform->params);
} }
Bool Bool
@ -82,8 +81,7 @@ 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;
dst->nparams = nparams; dst->nparams = nparams;

View File

@ -1868,8 +1868,7 @@ 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);
} }
if (pCanonClients && pCanonClients != (XID *)&stuff[1]) if (pCanonClients && pCanonClients != (XID *)&stuff[1])
@ -1955,8 +1954,7 @@ 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,8 +1524,7 @@ 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,8 +183,7 @@ _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,8 +662,7 @@ 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)
strcpy(prop->value,value); strcpy(prop->value,value);

View File

@ -312,8 +312,7 @@ 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;
} }
if (want_preserve) { if (want_preserve) {
@ -324,8 +323,7 @@ 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,8 +340,7 @@ 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,20 +220,15 @@ 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)
QueueWorkProc(XkbWriteRulesProp,NULL,NULL); QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
@ -244,28 +239,23 @@ 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);
} }
return; return;

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;