[X2Go-Commits] [nx-libs] 136/219: Display.c: safe some lines by calling SAFE_XFree and SAFE_free
git-admin at x2go.org
git-admin at x2go.org
Sat Sep 28 12:10:38 CEST 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch 3.6.x
in repository nx-libs.
commit b8411180ed1f3567ab5ca11d70834907fc54d711
Author: Ulrich Sibiller <uli42 at gmx.de>
Date: Mon Jul 22 18:16:20 2019 +0200
Display.c: safe some lines by calling SAFE_XFree and SAFE_free
---
nx-X11/programs/Xserver/hw/nxagent/Display.c | 65 +++++++---------------------
1 file changed, 16 insertions(+), 49 deletions(-)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index 127874962..1c18ad1a3 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -71,6 +71,7 @@ is" without express or implied warranty.
#include "Init.h"
#include "Args.h"
#include "Image.h"
+#include "Utils.h"
#define Pixmap XlibPixmap
#include "Icons.h"
@@ -1543,7 +1544,7 @@ void nxagentInitVisuals(void)
nxagentNumVisuals * sizeof(XVisualInfo));
}
- XFree(viList);
+ SAFE_XFree(viList);
if (nxagentNumVisuals == 0 || nxagentVisuals == NULL)
{
@@ -1765,20 +1766,11 @@ void nxagentCloseDisplay(void)
* traffic
*/
- free(nxagentDefaultColormaps);
- nxagentDefaultColormaps = NULL;
-
- XFree(nxagentVisuals);
- nxagentVisuals = NULL;
-
- free(nxagentDepths);
- nxagentDepths = NULL;
-
- XFree(nxagentPixmapFormats);
- nxagentPixmapFormats = NULL;
-
- XFree(nxagentRemotePixmapFormats);
- nxagentRemotePixmapFormats = NULL;
+ SAFE_free(nxagentDefaultColormaps);
+ SAFE_free(nxagentDepths);
+ SAFE_XFree(nxagentVisuals);
+ SAFE_XFree(nxagentPixmapFormats);
+ SAFE_XFree(nxagentRemotePixmapFormats);
nxagentFreeFontCache();
/*
@@ -2017,11 +2009,7 @@ void nxagentBackupDisplayInfo(void)
nxagentNumDefaultColormapsRecBackup = nxagentNumDefaultColormaps;
nxagentVisualsRecBackup = nxagentVisuals;
nxagentNumVisualsRecBackup = nxagentNumVisuals;
- if (nxagentVisualHasBeenIgnored)
- {
- free(nxagentVisualHasBeenIgnored);
- nxagentVisualHasBeenIgnored = NULL;
- }
+ SAFE_free(nxagentVisualHasBeenIgnored);
nxagentVisualHasBeenIgnored = malloc(nxagentNumVisuals * sizeof(Bool));
nxagentDefaultDepthRecBackup = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay));
nxagentDisplayWidthRecBackup = DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay));
@@ -2033,20 +2021,11 @@ void nxagentBackupDisplayInfo(void)
void nxagentCleanupBackupDisplayInfo(void)
{
- free(nxagentDepthsRecBackup);
- nxagentNumDepthsRecBackup = 0;
+ SAFE_free(nxagentDepthsRecBackup);
+ SAFE_free(nxagentVisualsRecBackup);
+ SAFE_free(nxagentVisualHasBeenIgnored);
nxagentNumDefaultColormapsRecBackup = 0;
-
- free(nxagentVisualsRecBackup);
- nxagentNumVisualsRecBackup = 0;
-
- if (nxagentVisualHasBeenIgnored)
- {
- free(nxagentVisualHasBeenIgnored);
- nxagentVisualHasBeenIgnored = NULL;
- }
-
nxagentDefaultDepthRecBackup = 0;
nxagentDisplayWidthRecBackup = 0;
nxagentDisplayHeightRecBackup = 0;
@@ -2054,7 +2033,6 @@ void nxagentCleanupBackupDisplayInfo(void)
if (nxagentDisplayBackup)
{
XCloseDisplay(nxagentDisplayBackup);
-
nxagentDisplayBackup = NULL;
}
@@ -2066,7 +2044,7 @@ void nxagentCleanupBackupDisplayInfo(void)
}
else
{
- free(nxagentBitmapGCBackup);
+ SAFE_free(nxagentBitmapGCBackup);
}
nxagentBitmapGCBackup = NULL;
@@ -2569,7 +2547,7 @@ FIXME: Should the visual be ignored in this case?
}
}
- XFree(viList);
+ SAFE_XFree(viList);
if (compatible)
{
@@ -2585,7 +2563,7 @@ FIXME: Should the visual be ignored in this case?
fprintf(stderr, "nxagentInitAndCheckVisuals: New visuals don't match with old visuals.\n");
#endif
- free(newVisuals);
+ SAFE_free(newVisuals);
}
return compatible;
@@ -2766,19 +2744,8 @@ Bool nxagentReconnectDisplay(void *p0)
* will be reallocated in nxagentInitPixmapFormats().
*/
- if (nxagentPixmapFormats != NULL)
- {
- XFree(nxagentPixmapFormats);
-
- nxagentPixmapFormats = NULL;
- }
-
- if (nxagentRemotePixmapFormats != NULL)
- {
- XFree(nxagentRemotePixmapFormats);
-
- nxagentRemotePixmapFormats = NULL;
- }
+ SAFE_XFree(nxagentPixmapFormats);
+ SAFE_XFree(nxagentRemotePixmapFormats);
/*
* Check if all the required pixmap
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list