aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-11-18 23:33:53 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-11-21 01:41:57 +0100
commit7e975e3ccff9aa809c1fec7b2642615f2a934c10 (patch)
tree87c4b5833476c339d20af4af5bc04e3d1daa7603
parent3b640a0f8de615e53dd6801ebd2aa0cf04f76c69 (diff)
downloadnx-libs-7e975e3ccff9aa809c1fec7b2642615f2a934c10.tar.gz
nx-libs-7e975e3ccff9aa809c1fec7b2642615f2a934c10.tar.bz2
nx-libs-7e975e3ccff9aa809c1fec7b2642615f2a934c10.zip
simply free() calls
free() can handle NULL so there's no need to check this ourselves
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c14
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Colormap.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Drawable.c28
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Font.c29
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/GC.c5
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/GCOps.c5
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Image.c11
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pixmap.c15
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c16
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c46
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c19
12 files changed, 50 insertions, 154 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 2b8d44388..ea970be02 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -729,12 +729,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
int size;
- if (nxagentKeyboard != NULL)
- {
- free(nxagentKeyboard);
-
- nxagentKeyboard = NULL;
- }
+ free(nxagentKeyboard);
+ nxagentKeyboard = NULL;
if ((size = strlen(argv[i])) < 256)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index d26d3524a..f34849d9a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -974,11 +974,8 @@ void nxagentNotifySelection(XEvent *X)
}
/*
- * if (pszReturnData)
- * {
- * free(pszReturnData);
- * pszReturnData=NULL;
- * }
+ * free(pszReturnData);
+ * pszReturnData=NULL;
*/
}
@@ -1500,11 +1497,8 @@ int nxagentInitClipboard(WindowPtr pWin)
fprintf(stderr, "nxagentInitClipboard: Got called.\n");
#endif
- if (lastSelectionOwner != NULL)
- {
- free(lastSelectionOwner);
- lastSelectionOwner = NULL;
- }
+ free(lastSelectionOwner);
+ lastSelectionOwner = NULL;
lastSelectionOwner = (SelectionOwner *) malloc(2 * sizeof(SelectionOwner));
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
index c21bcbbe7..401f05b94 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
@@ -257,8 +257,7 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
free(icws.cmapIDs);
if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
- if (nxagentOldInstalledColormapWindows)
- free(nxagentOldInstalledColormapWindows);
+ free(nxagentOldInstalledColormapWindows);
#ifdef _XSERVER64
{
@@ -318,13 +317,12 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
#endif /* DUMB_WINDOW_MANAGERS */
}
else
- if (icws.windows) free(icws.windows);
+ free(icws.windows);
}
void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen)
{
- if (nxagentOldInstalledColormapWindows)
- free(nxagentOldInstalledColormapWindows);
+ free(nxagentOldInstalledColormapWindows);
#ifdef _XSERVER64
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
index 917f460ba..c3d27073e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
@@ -264,7 +264,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success = 0;
- goto nxagentSynchronizeDrawableDataFree;
+ goto nxagentSynchronizeDrawableDataEnd;
}
ValidateGC(pDrawable, pGC);
@@ -282,7 +282,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success = 1;
- goto nxagentSynchronizeDrawableDataFree;
+ goto nxagentSynchronizeDrawableDataEnd;
}
else if (nxagentReconnectTrap == 1)
{
@@ -323,7 +323,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success = 0;
- goto nxagentSynchronizeDrawableDataFree;
+ goto nxagentSynchronizeDrawableDataEnd;
}
ValidateGC(pDrawable, pGC);
@@ -336,7 +336,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success = 1;
- goto nxagentSynchronizeDrawableDataFree;
+ goto nxagentSynchronizeDrawableDataEnd;
}
else
{
@@ -349,7 +349,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success = 1;
- goto nxagentSynchronizeDrawableDataFree;
+ goto nxagentSynchronizeDrawableDataEnd;
}
}
}
@@ -363,14 +363,8 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner);
-nxagentSynchronizeDrawableDataFree:
-
- if (data != NULL)
- {
- free(data);
- }
-
nxagentSynchronizeDrawableDataEnd:
+ free(data);
return success;
}
@@ -866,10 +860,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
#endif
}
- if (cmpData != NULL)
- {
- free(cmpData);
- }
+ free(cmpData);
}
}
else
@@ -1066,10 +1057,7 @@ nxagentSynchronizeRegionFree:
nxagentFreeRegion(pDrawable, clipRegion);
}
- if (data != NULL)
- {
- free(data);
- }
+ free(data);
RegionUninit(&exposeRegion);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c
index f9c682765..3b35a8bff 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Font.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c
@@ -841,10 +841,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
for (j = 0; j < numSearchFields; j++)
{
- if (searchFields[j] != NULL)
- {
- free(searchFields[j]);
- }
+ free(searchFields[j]);
}
}
}
@@ -863,10 +860,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
for (j = 0; j < numFontFields; j++)
{
- if (fontNameFields[j] != NULL)
- {
- free(fontNameFields[j]);
- }
+ free(fontNameFields[j]);
}
return fontStruct;
@@ -1260,17 +1254,11 @@ static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2)
static void nxagentFreeFailedToReconnectFonts()
{
- if (nxagentFailedToReconnectFonts.font != NULL)
- {
- free(nxagentFailedToReconnectFonts.font);
- nxagentFailedToReconnectFonts.font = NULL;
- }
+ free(nxagentFailedToReconnectFonts.font);
+ nxagentFailedToReconnectFonts.font = NULL;
- if (nxagentFailedToReconnectFonts.id != NULL)
- {
- free(nxagentFailedToReconnectFonts.id);
- nxagentFailedToReconnectFonts.id = NULL;
- }
+ free(nxagentFailedToReconnectFonts.id);
+ nxagentFailedToReconnectFonts.id = NULL;
nxagentFailedToReconnectFonts.size = 0;
nxagentFailedToReconnectFonts.index = 0;
@@ -1706,10 +1694,7 @@ int nxagentFreeFont(XFontStruct *fs)
#endif
}
- if (fs -> properties)
- {
- free (fs->properties);
- }
+ free (fs->properties);
XFree(fs);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c
index abe66602a..b6bff4cf2 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/GC.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c
@@ -924,10 +924,7 @@ static void nxagentRestoreGCRec(struct nxagentGCRec *t)
(void*)t, (void*)t -> gc);
#endif
- if (nxagentGC(t -> pGC))
- {
- free(nxagentGC(t -> pGC));
- }
+ free(nxagentGC(t -> pGC));
nxagentGC(t -> pGC) = t -> gc;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
index 1bca067fc..beb9ef05f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
@@ -1545,10 +1545,7 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
RESET_GC_TRAP();
}
- if (newPoints != NULL)
- {
- free(newPoints);
- }
+ free(newPoints);
}
void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c
index 590f0b249..978272f42 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Image.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c
@@ -1567,10 +1567,7 @@ nxagentPutSubImageEnd:
nxagentImageStatistics.totalEncoded, nxagentImageStatistics.totalAdded);
#endif
- if (packedChecksum != NULL)
- {
- free(packedChecksum);
- }
+ free(packedChecksum);
if (packedImage != NULL)
{
@@ -1787,11 +1784,7 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio,
}
}
- if (image -> obdata != NULL)
- {
- free((char *) image -> obdata);
- }
-
+ free((char *) image -> obdata);
free((char *) image);
*pImage = newImage;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
index be5408d13..853621709 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
@@ -1172,10 +1172,7 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
XDestroyImage(image);
}
- if (data != NULL)
- {
- free(data);
- }
+ free(data);
}
else
{
@@ -1421,10 +1418,7 @@ FIXME: If the pixmap has a different depth from the window, the
fprintf(stderr, "nxagentPixmapOnShadowDisplay: XCreateImage failed.\n");
#endif
- if (data != NULL)
- {
- free(data);
- }
+ free(data);
return False;
}
@@ -1583,10 +1577,7 @@ Bool nxagentFbOnShadowDisplay()
fprintf(stderr, "nxagentFbOnShadowDisplay: XCreateImage failed.\n");
#endif
- if (data)
- {
- free(data);
- }
+ free(data);
return False;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index cae0a397b..cafa219ec 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -610,12 +610,8 @@ Bool nxagentReconnectSession(void)
nxagentXkbState.Initialized = 0;
- if (nxagentOldKeyboard != NULL)
- {
- free(nxagentOldKeyboard);
-
- nxagentOldKeyboard = NULL;
- }
+ free(nxagentOldKeyboard);
+ nxagentOldKeyboard = NULL;
nxagentInitPointerMap();
@@ -739,12 +735,8 @@ nxagentReconnectError:
nxagentDisconnectDisplay();
}
- if (nxagentOldKeyboard != NULL)
- {
- free(nxagentOldKeyboard);
-
- nxagentOldKeyboard = NULL;
- }
+ free(nxagentOldKeyboard);
+ nxagentOldKeyboard = NULL;
return 0;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index fb4ab9b19..90ebe9829 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -3079,10 +3079,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
length = nxagentImageLength(width, height, ZPixmap, 0, nxagentMasterDepth);
- if (tBuffer)
- {
- free(tBuffer);
- }
+ free(tBuffer);
tBuffer = malloc(length);
@@ -3139,10 +3136,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
RegionUnion(&nxagentShadowUpdateRegion, &nxagentShadowUpdateRegion, &updateRegion);
}
- if (tBuffer)
- {
- free(tBuffer);
- }
+ free(tBuffer);
RegionUninit(&updateRegion);
}
@@ -3360,10 +3354,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
cBuffer = (unsigned char *) *buffer;
*buffer = (char *) icBuffer;
- if (cBuffer != NULL)
- {
- free(cBuffer);
- }
+ free(cBuffer);
}
#ifdef NXAGENT_ARTSD
@@ -3826,9 +3817,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#endif
number = 1;
- if (screeninfo) {
- free(screeninfo);
- }
+ free(screeninfo);
+
if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) {
return FALSE;
}
@@ -4111,10 +4101,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
}
/* release allocated memory */
- if (screeninfo) {
- free(screeninfo);
- screeninfo = NULL;
- }
+ free(screeninfo);
+ screeninfo = NULL;
#ifdef DEBUG
for (i = 0; i < pScrPriv->numCrtcs; i++) {
@@ -4587,10 +4575,7 @@ FIXME
fprintf(stderr, "nxagentShowPixmap: XGetImage failed.\n");
#endif
- if (data)
- {
- free(data);
- }
+ free(data);
return;
}
@@ -4623,10 +4608,7 @@ FIXME
XDestroyImage(image);
}
- if (data != NULL)
- {
- free(data);
- }
+ free(data);
/*
FIXME
@@ -4678,10 +4660,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
fprintf(stderr, "nxagentFbRestoreArea: XGetImage failed.\n");
#endif
- if (data)
- {
- free(data);
- }
+ free(data);
return;
}
@@ -4741,10 +4720,7 @@ FIXME
/*
FIXME
- if (data)
- {
- free(data);
- }
+ free(data);
*/
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index d58a2516d..2fa6bc136 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -3151,12 +3151,7 @@ FIXME: Do we need to set save unders attribute here?
&hints);
#ifdef _XSERVER64
-
- if (data64 != NULL)
- {
- free(data64);
- }
-
+ free(data64);
#endif
}
}
@@ -3404,10 +3399,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin)
XDestroyImage(image);
}
- if (data)
- {
- free(data);
- }
+ free(data);
}
else
{
@@ -3947,11 +3939,8 @@ int nxagentEmptyBSPixmapList()
for (i = 0; i < BSPIXMAPLIMIT; i++)
{
- if (nxagentBSPixmapList[i] != NULL)
- {
- free(nxagentBSPixmapList[i]);
- nxagentBSPixmapList[i] = NULL;
- }
+ free(nxagentBSPixmapList[i]);
+ nxagentBSPixmapList[i] = NULL;
}
return 1;