aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-07-22 18:11:59 +0200
committerUlrich Sibiller <uli42@gmx.de>2019-08-06 21:57:32 +0200
commitd8012d2a87ca4d1e7c3b0a04a58b4e4e0cc83abd (patch)
tree5502556f46af4300d81b4da28a1b8f36be58ddf6 /nx-X11/programs/Xserver/hw
parentebc2ea79f7343c4ced8277b80178091a3226ea72 (diff)
downloadnx-libs-d8012d2a87ca4d1e7c3b0a04a58b4e4e0cc83abd.tar.gz
nx-libs-d8012d2a87ca4d1e7c3b0a04a58b4e4e0cc83abd.tar.bz2
nx-libs-d8012d2a87ca4d1e7c3b0a04a58b4e4e0cc83abd.zip
Screen.c: safe some lines by calling SAFE_XFree
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c73
1 files changed, 29 insertions, 44 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index d1dc37dc2..62634de60 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -304,8 +304,7 @@ Bool nxagentIsParentOf(Display *d, XlibWindow possible_parent, XlibWindow candid
if (XQueryTree(d, candidate, &root, &parent, &children, &num_children))
{
- if (children)
- XFree((char *)children);
+ SAFE_XFree(children);
#ifdef TEST
fprintf(stderr, "%s: parent of full screen window [%p] root [%p] possible_parent [%p] candidate [%p]\n", __func__, parent, root, possible_parent, candidate);
@@ -490,11 +489,8 @@ Window nxagentCreateIconWindow(void)
window_name, window_name,
NULL , 0 , sizeHints, wmHints, NULL);
- if (sizeHints)
- XFree(sizeHints);
-
- if (wmHints)
- XFree(wmHints);
+ SAFE_XFree(sizeHints);
+ SAFE_XFree(wmHints);
/*
* Enable events from the icon window.
@@ -895,10 +891,9 @@ void freeDepths(DepthPtr depths, int num)
#ifdef DEBUG
fprintf(stderr, "%s: freeing depth [%d] index [%d] vids [%p]\n", __func__, depths[i].depth, i, (void*) depths[i].vids);
#endif
- free(depths[i].vids);
- depths[i].vids = NULL;
+ SAFE_free(depths[i].vids);
}
- free(depths);
+ SAFE_free(depths);
}
Bool nxagentOpenScreen(ScreenPtr pScreen,
@@ -1393,7 +1388,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
if (!pFrameBufferBits)
{
freeDepths(depths, numDepths);
- free(visuals);
+ SAFE_free(visuals);
return FALSE;
}
@@ -1416,7 +1411,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
monitorResolution, monitorResolution, PixmapBytePad(nxagentOption(RootWidth), rootDepth), bitsPerPixel))
{
freeDepths(depths, numDepths);
- free(visuals);
+ SAFE_free(visuals);
return FALSE;
}
@@ -1457,7 +1452,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
pScreen -> numDepths = numDepths;
pScreen -> rootDepth = rootDepth;
- free(pScreen -> visuals);
+ SAFE_free(pScreen -> visuals);
pScreen -> visuals = visuals;
pScreen -> numVisuals = numVisuals;
pScreen -> rootVisual = defaultVisual;
@@ -1898,8 +1893,8 @@ N/A
hint.res_class = strdup("NXAgent");
}
XSetClassHint(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &hint);
- free(hint.res_name);
- free(hint.res_class);
+ SAFE_free(hint.res_name);
+ SAFE_free(hint.res_class);
}
if (nxagentOption(Fullscreen))
@@ -1983,17 +1978,8 @@ N/A
nxagentWindowName,
argv , argc , sizeHints, wmHints, NULL);
- if (sizeHints)
- {
- XFree(sizeHints);
- sizeHints = NULL;
- }
-
- if (wmHints)
- {
- XFree(wmHints);
- wmHints = NULL;
- }
+ SAFE_XFree(sizeHints);
+ SAFE_XFree(wmHints);
/*
* Clear the window but let it unmapped. We'll map it
@@ -2205,9 +2191,9 @@ Bool nxagentCloseScreen(ScreenPtr pScreen)
* Free the frame buffer.
*/
- free(((PixmapPtr)pScreen -> devPrivate) -> devPrivate.ptr);
- free(pScreen->devPrivate);pScreen->devPrivate = NULL;
- free(pScreen->visuals); pScreen->visuals = NULL;
+ SAFE_free(((PixmapPtr)pScreen -> devPrivate) -> devPrivate.ptr);
+ SAFE_free(pScreen->devPrivate);
+ SAFE_free(pScreen->visuals);
fbCloseScreen(pScreen);
@@ -3167,7 +3153,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
length = nxagentImageLength(width, height, ZPixmap, 0, nxagentMasterDepth);
- free(tBuffer);
+ SAFE_free(tBuffer);
tBuffer = malloc(length);
@@ -3224,7 +3210,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
RegionUnion(&nxagentShadowUpdateRegion, &nxagentShadowUpdateRegion, &updateRegion);
}
- free(tBuffer);
+ SAFE_free(tBuffer);
RegionUninit(&updateRegion);
}
@@ -3442,7 +3428,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
cBuffer = (unsigned char *) *buffer;
*buffer = (char *) icBuffer;
- free(cBuffer);
+ SAFE_free(cBuffer);
}
#ifdef NXAGENT_ARTSD
@@ -3625,7 +3611,7 @@ FIXME: The port information is not used at the moment and produces a
strlen(local_buf), local_buf, 1);
}
- free(local_buf);
+ SAFE_free(local_buf);
}
}
}
@@ -4049,7 +4035,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#endif
number = 1;
- free(screeninfo);
+ SAFE_free(screeninfo);
if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) {
return FALSE;
@@ -4318,8 +4304,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
}
/* release allocated memory */
- free(screeninfo);
- screeninfo = NULL;
+ SAFE_free(screeninfo);
#ifdef DEBUG
for (i = 0; i < pScrPriv->numCrtcs; i++) {
@@ -4434,7 +4419,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted);
- free((char *) pRects);
+ SAFE_free(pRects);
extents = *RegionExtents(&cleanRegion);
@@ -4580,7 +4565,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted);
- free(pRects);
+ SAFE_free(pRects);
extents = *RegionExtents(clipRegion);
@@ -4660,7 +4645,7 @@ void nxagentSetWMNormalHints(int screen, int width, int height)
XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[screen], sizeHints);
- XFree(sizeHints);
+ SAFE_XFree(sizeHints);
}
/*
@@ -4679,7 +4664,7 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheig
sizeHints->max_height = maxheight;
XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
sizeHints);
- XFree(sizeHints);
+ SAFE_XFree(sizeHints);
}
}
@@ -4820,7 +4805,7 @@ FIXME
fprintf(stderr, "nxagentShowPixmap: XGetImage failed.\n");
#endif
- free(data);
+ SAFE_free(data);
return;
}
@@ -4853,7 +4838,7 @@ FIXME
XDestroyImage(image);
}
- free(data);
+ SAFE_free(data);
/*
FIXME
@@ -4905,7 +4890,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
fprintf(stderr, "nxagentFbRestoreArea: XGetImage failed.\n");
#endif
- free(data);
+ SAFE_free(data);
return;
}
@@ -4965,7 +4950,7 @@ FIXME
/*
FIXME
- free(data);
+ SAFE_free(data);
*/
}