Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
6f80a06f
Unverified
Commit
6f80a06f
authored
Aug 27, 2019
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/safe_free' into 3.6.x
Attributes GH PR #826:
https://github.com/ArcticaProject/nx-libs/pull/826
parents
8b15d574
f39b81d3
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
217 additions
and
316 deletions
+217
-316
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+6
-8
Atoms.c
nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+6
-10
Clipboard.c
nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+1
-2
Colormap.c
nx-X11/programs/Xserver/hw/nxagent/Colormap.c
+11
-10
Cursor.c
nx-X11/programs/Xserver/hw/nxagent/Cursor.c
+3
-4
Display.c
nx-X11/programs/Xserver/hw/nxagent/Display.c
+16
-49
Drawable.c
nx-X11/programs/Xserver/hw/nxagent/Drawable.c
+6
-5
Error.c
nx-X11/programs/Xserver/hw/nxagent/Error.c
+7
-6
Events.c
nx-X11/programs/Xserver/hw/nxagent/Events.c
+7
-28
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+26
-37
GC.c
nx-X11/programs/Xserver/hw/nxagent/GC.c
+9
-9
GCOps.c
nx-X11/programs/Xserver/hw/nxagent/GCOps.c
+4
-3
Image.c
nx-X11/programs/Xserver/hw/nxagent/Image.c
+12
-15
Keyboard.c
nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+34
-36
Keystroke.c
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+2
-2
Pixmap.c
nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
+7
-6
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+5
-7
Render.c
nx-X11/programs/Xserver/hw/nxagent/Render.c
+3
-2
Rootless.c
nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+6
-9
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+29
-44
Utils.h
nx-X11/programs/Xserver/hw/nxagent/Utils.h
+1
-0
Window.c
nx-X11/programs/Xserver/hw/nxagent/Window.c
+16
-24
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
6f80a06f
...
...
@@ -195,7 +195,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
char
*
basec
=
strdup
(
argv
[
0
]);
nxagentProgName
=
strdup
(
basename
(
basec
));
free
(
basec
);
SAFE_
free
(
basec
);
/*
* Check if we are running as X2Go Agent
...
...
@@ -270,7 +270,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentParseOptionString
(
envOptions
);
free
(
envOptions
);
SAFE_
free
(
envOptions
);
}
for
(
j
=
0
;
j
<
argc
;
j
++
)
...
...
@@ -378,8 +378,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
if
(
++
i
<
argc
)
{
free
(
nxagentOptionsFilenameOrString
);
nxagentOptionsFilenameOrString
=
NULL
;
SAFE_free
(
nxagentOptionsFilenameOrString
);
if
(
-
1
==
asprintf
(
&
nxagentOptionsFilenameOrString
,
"%s"
,
argv
[
i
]))
{
...
...
@@ -716,8 +715,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
if
(
++
i
<
argc
)
{
free
(
nxagentKeyboard
);
nxagentKeyboard
=
NULL
;
SAFE_free
(
nxagentKeyboard
);
nxagentKeyboard
=
strdup
(
argv
[
i
]);
if
(
nxagentKeyboard
==
NULL
)
...
...
@@ -1574,7 +1572,7 @@ static void nxagentParseSingleOption(char *name, char *value)
ddxProcessArgument
(
argc
,
argv
,
0
);
free
(
argv
[
0
]);
SAFE_
free
(
argv
[
0
]);
}
static
void
nxagentParseOptionString
(
char
*
string
)
...
...
@@ -1761,7 +1759,7 @@ void nxagentProcessOptionsFile(char * filename)
nxagentProcessOptionsFileExit:
free
(
data
);
SAFE_
free
(
data
);
if
(
file
)
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Atoms.c
View file @
6f80a06f
...
...
@@ -43,6 +43,7 @@
#include "Screen.h"
#include "Options.h"
#include "Agent.h"
#include "Utils.h"
/*
* Set here the required log level.
...
...
@@ -53,11 +54,6 @@
#undef TEST
#undef DEBUG
#ifdef DEBUG
/* for validateString() */
#include "Utils.h"
#endif
/*
* These values should be moved in
* the option repository.
...
...
@@ -482,8 +478,8 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
fprintf
(
stderr
,
"nxagentInitAtomMap: WARNING! XInternAtoms request failed.
\n
"
);
#endif
free
(
atom_list
);
free
(
name_list
);
SAFE_
free
(
atom_list
);
SAFE_
free
(
name_list
);
return
0
;
}
...
...
@@ -523,8 +519,8 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
}
}
free
(
atom_list
);
free
(
name_list
);
SAFE_
free
(
atom_list
);
SAFE_
free
(
name_list
);
nxagentPrintAtomMapInfo
(
"nxagentInitAtomMap: Exiting"
);
...
...
@@ -794,7 +790,7 @@ Atom nxagentRemoteToLocalAtom(Atom remote)
#ifdef TEST
fprintf
(
stderr
,
"%s: remote [%d (%s)] -> local [%d]
\n
"
,
__func__
,
remote
,
string
,
local
);
#endif
XFree
(
string
);
SAFE_
XFree
(
string
);
return
local
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
View file @
6f80a06f
...
...
@@ -1783,8 +1783,7 @@ int nxagentInitClipboard(WindowPtr pWin)
fprintf
(
stderr
,
"%s: Got called.
\n
"
,
__func__
);
#endif
free
(
lastSelectionOwner
);
lastSelectionOwner
=
NULL
;
SAFE_free
(
lastSelectionOwner
);
lastSelectionOwner
=
(
SelectionOwner
*
)
malloc
(
nxagentMaxSelections
*
sizeof
(
SelectionOwner
));
...
...
nx-X11/programs/Xserver/hw/nxagent/Colormap.c
View file @
6f80a06f
...
...
@@ -54,6 +54,7 @@ is" without express or implied warranty.
#include "Visual.h"
#include "Windows.h"
#include "Args.h"
#include "Utils.h"
#define PANIC
#define WARNING
...
...
@@ -120,7 +121,7 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
pCmap
->
red
[
i
].
co
.
local
.
green
=
colors
[
i
].
red
;
pCmap
->
red
[
i
].
co
.
local
.
blue
=
colors
[
i
].
red
;
}
free
(
colors
);
SAFE_
free
(
colors
);
break
;
case
StaticColor
:
/* read only */
...
...
@@ -133,7 +134,7 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
pCmap
->
red
[
i
].
co
.
local
.
green
=
colors
[
i
].
green
;
pCmap
->
red
[
i
].
co
.
local
.
blue
=
colors
[
i
].
blue
;
}
free
(
colors
);
SAFE_
free
(
colors
);
break
;
case
TrueColor
:
/* read only */
...
...
@@ -157,7 +158,7 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
pCmap
->
green
[
i
].
co
.
local
.
green
=
colors
[
i
].
green
;
pCmap
->
blue
[
i
].
co
.
local
.
blue
=
colors
[
i
].
blue
;
}
free
(
colors
);
SAFE_
free
(
colors
);
break
;
case
GrayScale
:
/* read and write */
...
...
@@ -176,7 +177,7 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
void
nxagentDestroyColormap
(
ColormapPtr
pCmap
)
{
XFreeColormap
(
nxagentDisplay
,
nxagentColormap
(
pCmap
));
free
(
pCmap
->
devPriv
);
SAFE_
free
(
pCmap
->
devPriv
);
}
#define SEARCH_PREDICATE \
...
...
@@ -254,10 +255,10 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
numWindows
=
0
;
}
free
(
icws
.
cmapIDs
);
SAFE_
free
(
icws
.
cmapIDs
);
if
(
!
nxagentSameInstalledColormapWindows
(
icws
.
windows
,
icws
.
numWindows
))
{
free
(
nxagentOldInstalledColormapWindows
);
SAFE_
free
(
nxagentOldInstalledColormapWindows
);
#ifdef _XSERVER64
{
...
...
@@ -268,7 +269,7 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
windows
[
i
]
=
icws
.
windows
[
i
];
XSetWMColormapWindows
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
windows
,
numWindows
);
free
(
windows
);
SAFE_
free
(
windows
);
}
#else
XSetWMColormapWindows
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
...
...
@@ -317,12 +318,12 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
#endif
/* DUMB_WINDOW_MANAGERS */
}
else
free
(
icws
.
windows
);
SAFE_
free
(
icws
.
windows
);
}
void
nxagentSetScreenSaverColormapWindow
(
ScreenPtr
pScreen
)
{
free
(
nxagentOldInstalledColormapWindows
);
SAFE_
free
(
nxagentOldInstalledColormapWindows
);
#ifdef _XSERVER64
{
...
...
@@ -454,7 +455,7 @@ void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
pColors64
[
i
].
flags
=
pColors
[
i
].
flags
;
}
XStoreColors
(
nxagentDisplay
,
nxagentColormap
(
pCmap
),
pColors64
,
nColors
);
free
(
pColors64
);
SAFE_
free
(
pColors64
);
}
#else
XStoreColors
(
nxagentDisplay
,
nxagentColormap
(
pCmap
),
...
...
nx-X11/programs/Xserver/hw/nxagent/Cursor.c
View file @
6f80a06f
...
...
@@ -61,6 +61,7 @@ is" without express or implied warranty.
#include "Events.h"
#include "Render.h"
#include "Client.h"
#include "Utils.h"
#include "windowstr.h"
#include "resource.h"
...
...
@@ -211,7 +212,7 @@ Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
XPutImage
(
nxagentDisplay
,
source
,
nxagentBitmapGC
,
image
,
0
,
0
,
0
,
0
,
pCursor
->
bits
->
width
,
pCursor
->
bits
->
height
);
XFree
(
image
);
SAFE_
XFree
(
image
);
image
=
XCreateImage
(
nxagentDisplay
,
nxagentDefaultVisual
(
pScreen
),
...
...
@@ -229,7 +230,7 @@ Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
XPutImage
(
nxagentDisplay
,
mask
,
nxagentBitmapGC
,
image
,
0
,
0
,
0
,
0
,
pCursor
->
bits
->
width
,
pCursor
->
bits
->
height
);
XFree
(
image
);
SAFE_
XFree
(
image
);
fg_color
.
red
=
pCursor
->
foreRed
;
fg_color
.
green
=
pCursor
->
foreGreen
;
...
...
@@ -264,14 +265,12 @@ Bool nxagentUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
if
(
nxagentCursorUsesRender
(
pCursor
,
pScreen
))
{
PicturePtr
pPicture
=
nxagentCursorPicture
(
pCursor
,
pScreen
);
FreePicture
(
pPicture
,
pPicture
->
id
);
}
if
(
nxagentCursor
(
pCursor
,
pScreen
)
!=
None
)
{
XFreeCursor
(
nxagentDisplay
,
nxagentCursor
(
pCursor
,
pScreen
));
nxagentCursor
(
pCursor
,
pScreen
)
=
None
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Display.c
View file @
6f80a06f
...
...
@@ -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"
...
...
@@ -1534,7 +1535,7 @@ void nxagentInitVisuals(void)
nxagentNumVisuals
*
sizeof
(
XVisualInfo
));
}
XFree
(
viList
);
SAFE_
XFree
(
viList
);
if
(
nxagentNumVisuals
==
0
||
nxagentVisuals
==
NULL
)
{
...
...
@@ -1756,20 +1757,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
();
/*
...
...
@@ -2008,11 +2000,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
));
...
...
@@ -2024,20 +2012,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
;
...
...
@@ -2045,7 +2024,6 @@ void nxagentCleanupBackupDisplayInfo(void)
if
(
nxagentDisplayBackup
)
{
XCloseDisplay
(
nxagentDisplayBackup
);
nxagentDisplayBackup
=
NULL
;
}
...
...
@@ -2057,7 +2035,7 @@ void nxagentCleanupBackupDisplayInfo(void)
}
else
{
free
(
nxagentBitmapGCBackup
);
SAFE_
free
(
nxagentBitmapGCBackup
);
}
nxagentBitmapGCBackup
=
NULL
;
...
...
@@ -2560,7 +2538,7 @@ FIXME: Should the visual be ignored in this case?
}
}
XFree
(
viList
);
SAFE_
XFree
(
viList
);
if
(
compatible
)
{
...
...
@@ -2576,7 +2554,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
;
...
...
@@ -2757,19 +2735,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
...
...
nx-X11/programs/Xserver/hw/nxagent/Drawable.c
View file @
6f80a06f
...
...
@@ -42,6 +42,7 @@
#include "Pixels.h"
#include "Reconnect.h"
#include "GCOps.h"
#include "Utils.h"
#include "compext/Compext.h"
...
...
@@ -365,7 +366,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success
=
nxagentSynchronizeRegion
(
pDrawable
,
NullRegion
,
breakMask
,
owner
);
nxagentSynchronizeDrawableDataEnd:
free
(
data
);
SAFE_
free
(
data
);
return
success
;
}
...
...
@@ -861,7 +862,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
#endif
}
free
(
cmpData
);
SAFE_
free
(
cmpData
);
}
}
else
...
...
@@ -1058,7 +1059,7 @@ nxagentSynchronizeRegionFree:
nxagentFreeRegion
(
pDrawable
,
clipRegion
);
}
free
(
data
);
SAFE_
free
(
data
);
RegionUninit
(
&
exposeRegion
);
...
...
@@ -2158,7 +2159,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel)
fprintf
(
stderr
,
"nxagentGetColor: WARNING! Failed to create the XImage.
\n
"
);
#endif
free
(
data
);
SAFE_
free
(
data
);
return
-
1
;
}
...
...
@@ -2384,7 +2385,7 @@ void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion)
XFillRectangles
(
nxagentDisplay
,
nxagentDrawable
(
pDrawable
),
nxagentGC
(
pGC
),
pRects
,
nrects
);
free
(
pRects
);
SAFE_
free
(
pRects
);
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Error.c
View file @
6f80a06f
...
...
@@ -42,6 +42,7 @@
#include "Error.h"
#include "Args.h"
#include "Utils.h"
/*
* Set here the required log level.
...
...
@@ -425,7 +426,7 @@ char *nxagentGetRootPath(void)
"home directory '%s'.
\n
"
,
homeEnv
);
#endif
free
(
homeEnv
);
SAFE_
free
(
homeEnv
);
return
NULL
;
}
...
...
@@ -436,7 +437,7 @@ char *nxagentGetRootPath(void)
snprintf
(
nxagentRootDir
,
DEFAULT_STRING_LENGTH
,
"%s/.nx"
,
homeEnv
);
free
(
homeEnv
);
SAFE_
free
(
homeEnv
);
/*
* Create the NX root directory.
...
...
@@ -534,14 +535,14 @@ char *nxagentGetSessionPath(void)
nxagentSessionDir
);
#endif
free
(
rootPath
);
SAFE_
free
(
rootPath
);
return
NULL
;
}
snprintf
(
nxagentSessionDir
,
DEFAULT_STRING_LENGTH
,
"%s/C-%s"
,
rootPath
,
nxagentSessionId
);
free
(
rootPath
);
SAFE_
free
(
rootPath
);
if
((
stat
(
nxagentSessionDir
,
&
dirStat
)
==
-
1
)
&&
(
errno
==
ENOENT
))
{
...
...
@@ -595,14 +596,14 @@ void nxagentGetClientsPath(void)
fprintf
(
stderr
,
"nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path ''.
\n
"
);
#endif
free
(
sessionPath
);
SAFE_
free
(
sessionPath
);
return
;
}
snprintf
(
nxagentClientsLogName
,
NXAGENTCLIENTSLOGNAMELENGTH
,
"%s/clients"
,
sessionPath
);
free
(
sessionPath
);
SAFE_
free
(
sessionPath
);
}
return
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Events.c
View file @
6f80a06f
...
...
@@ -328,7 +328,7 @@ void nxagentRemoteWindowID(Window window, Bool newline)
else
if
(
winName
)
{
fprintf
(
stderr
,
"
\"
%s
\"
"
,
winName
);
XFree
(
winName
);
SAFE_
XFree
(
winName
);
}
#else
...
...
@@ -476,10 +476,7 @@ void nxagentRemoteWindowsTree(Window window, int level)
nxagentRemoteWindowsTree
(
childList
[
i
],
level
+
1
);
}
if
(
childList
)
{
XFree
((
char
*
)
childList
);
}
SAFE_XFree
((
char
*
)
childList
);
}
#endif
...
...
@@ -3133,10 +3130,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X)
#endif
}
if
(
children_return
)
{
XFree
(
children_return
);
}
SAFE_XFree
(
children_return
);
#if 0
fprintf(stderr, "nxagentCheckWindowConfiguration: Trees match: %s\n",
...
...
@@ -3514,11 +3508,7 @@ int nxagentHandleReparentNotify(XEvent* X)
result
=
XQueryTree
(
nxagentDisplay
,
w
,
&
root_return
,
&
parent_return
,
&
children_return
,
&
nchildren_return
);
if
(
children_return
)
{
XFree
(
children_return
);
children_return
=
NULL
;
}
SAFE_XFree
(
children_return
);
if
(
!
result
)
{
...
...
@@ -3556,11 +3546,7 @@ int nxagentHandleReparentNotify(XEvent* X)
#endif
}
if
(
children_return
)
{
XFree
(
children_return
);
children_return
=
NULL
;
}
SAFE_XFree
(
children_return
);
}
else
{
...
...
@@ -3624,11 +3610,7 @@ int nxagentHandleReparentNotify(XEvent* X)
result
=
XQueryTree
(
nxagentDisplay
,
w
,
&
rootReturn
,
&
parentReturn
,
&
childrenReturn
,
&
nchildrenReturn
);
if
(
childrenReturn
)
{
XFree
(
childrenReturn
);
childrenReturn
=
NULL
;
}
SAFE_XFree
(
childrenReturn
);
if
(
parentReturn
==
rootReturn
||
parentReturn
==
0
||
result
==
0
)
{
...
...
@@ -4025,10 +4007,7 @@ void nxagentHandleCollectPropertyEvent(XEvent *X)
#endif
}
if
(
pszReturnData
!=
NULL
)
{
XFree
(
pszReturnData
);
}
SAFE_XFree
(
pszReturnData
);
return
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
6f80a06f
...
...
@@ -188,11 +188,11 @@ void nxagentFreeFontCache(void)
nxagentFreeFont
(
CACHE_FSTRUCT
(
i
));
}
free
(
CACHE_NAME
(
i
));
free
(
CACHE_ENTRY
(
i
));
SAFE_
free
(
CACHE_NAME
(
i
));
SAFE_
free
(
CACHE_ENTRY
(
i
));
}
free
(
CACHE_ENTRY_PTR
);
SAFE_
free
(
CACHE_ENTRY_PTR
);
CACHE_ENTRY_PTR
=
NULL
;
CACHE_INDEX
=
0
;
CACHE_SIZE
=
0
;
...
...
@@ -324,8 +324,7 @@ void nxagentListRemoteAddName(const char *name, int status)
if
(
nxagentRemoteFontList
.
list
[
pos
]
->
name
==
NULL
)
{
fprintf
(
stderr
,
"Font: remote list name memory allocation failed!.
\n
"
);
free
(
nxagentRemoteFontList
.
list
[
pos
]);
nxagentRemoteFontList
.
list
[
pos
]
=
NULL
;
SAFE_free
(
nxagentRemoteFontList
.
list
[
pos
]);
return
;
}
}
...
...
@@ -351,18 +350,14 @@ static void nxagentFreeRemoteFontList(nxagentFontList *listRec)
{
if
(
listRec
->
list
[
l
])
{
free
(
listRec
->
list
[
l
]
->
name
);
listRec
->
list
[
l
]
->
name
=
NULL
;
free
(
listRec
->
list
[
l
]);
listRec
->
list
[
l
]
=
NULL
;
SAFE_free
(
listRec
->
list
[
l
]
->
name
);
SAFE_free
(
listRec
->
list
[
l
]);
}
}
listRec
->
length
=
listRec
->
listSize
=
0
;
free
(
listRec
->
list
);
listRec
->
list
=
NULL
;
SAFE_free
(
listRec
->
list
);
return
;
}
...
...
@@ -434,7 +429,7 @@ Bool nxagentFontLookUp(const char *name)
{
result
=
nxagentFontFind
(
scalable
,
&
i
);
free
(
scalable
);
SAFE_
free
(
scalable
);
}
}
...
...
@@ -448,7 +443,7 @@ Bool nxagentFontLookUp(const char *name)
{
result
=
nxagentFontFind
(
scalable
,
&
i
);
free
(
scalable
);
SAFE_
free
(
scalable
);
}
}
...
...
@@ -813,7 +808,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
for
(
j
=
0
;
j
<
numSearchFields
;
j
++
)
{
free
(
searchFields
[
j
]);
SAFE_
free
(
searchFields
[
j
]);
}
}
}
...
...
@@ -830,7 +825,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
for
(
j
=
0
;
j
<
numFontFields
;
j
++
)
{
free
(
fontNameFields
[
j
]);
SAFE_
free
(
fontNameFields
[
j
]);
}
return
fontStruct
;
...
...
@@ -890,10 +885,8 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
if
(
nxagentFailedToReconnectFonts
.
font
==
NULL
||
nxagentFailedToReconnectFonts
.
id
==
NULL
)
{
free
(
nxagentFailedToReconnectFonts
.
font
);
nxagentFailedToReconnectFonts
.
font
=
NULL
;
free
(
nxagentFailedToReconnectFonts
.
id
);
nxagentFailedToReconnectFonts
.
id
=
NULL
;
SAFE_free
(
nxagentFailedToReconnectFonts
.
font
);
SAFE_free
(
nxagentFailedToReconnectFonts
.
id
);
FatalError
(
"Font: font not reconnected memory allocation failed!.
\n
"
);
}
...
...
@@ -1050,7 +1043,7 @@ static void nxagentCleanCacheAfterReconnect(void)
{
if
(
CACHE_FSTRUCT
(
i
)
==
NULL
)
{
XFree
(
CACHE_NAME
(
i
));
SAFE_
XFree
(
CACHE_NAME
(
i
));
real_size
--
;
}
}
...
...
@@ -1223,11 +1216,8 @@ static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2)
static
void
nxagentFreeFailedToReconnectFonts
(
void
)
{
free
(
nxagentFailedToReconnectFonts
.
font
);
nxagentFailedToReconnectFonts
.
font
=
NULL
;
free
(
nxagentFailedToReconnectFonts
.
id
);
nxagentFailedToReconnectFonts
.
id
=
NULL
;
SAFE_free
(
nxagentFailedToReconnectFonts
.
font
);
SAFE_free
(
nxagentFailedToReconnectFonts
.
id
);
nxagentFailedToReconnectFonts
.
size
=
0
;
nxagentFailedToReconnectFonts
.
index
=
0
;
...
...
@@ -1321,7 +1311,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
nxagentListRemoteFonts
(
"*"
,
nxagentMaxFontNames
);
XFreeFontPath
(
fontPaths
);
free
(
newFontPaths
);
SAFE_
free
(
newFontPaths
);
return
False
;
}
...
...
@@ -1332,7 +1322,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
XSetFontPath
(
nxagentDisplay
,
fontPaths
,
nPaths
);
XFreeFontPath
(
fontPaths
);
free
(
newFontPaths
);
SAFE_
free
(
newFontPaths
);
nxagentCleanCacheAfterReconnect
();
...
...
@@ -1442,7 +1432,7 @@ void nxagentVerifySingleFontPath(char **dest, const char *fontDir)
if
(
rc
==
-
1
)
return
;
free
(
*
dest
);
SAFE_
free
(
*
dest
);
*
dest
=
tmppath
;
tmppath
=
NULL
;
}
...
...
@@ -1554,7 +1544,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
fprintf
(
stderr
,
"nxagentLoadQueryFont: WARNING! Font not found '%s'.
\n
"
,
name
);
#endif
free
(
fs
);
SAFE_
free
(
fs
);
return
(
XFontStruct
*
)
NULL
;
}
...
...
@@ -1588,7 +1578,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
fprintf
(
stderr
,
"nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."
);
#endif
free
((
char
*
)
fs
);
SAFE_free
(
fs
);
return
(
XFontStruct
*
)
NULL
;
}
...
...
@@ -1622,18 +1612,17 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
int
nxagentFreeFont
(
XFontStruct
*
fs
)
{
if
(
fs
->
per_char
)
if
(
fs
->
per_char
)
{
#ifdef USE_XF86BIGFONT
_XF86BigfontFreeFontMetrics
(
fs
);
#else
free
((
char
*
)
fs
->
per_char
);
SAFE_free
(
fs
->
per_char
);
#endif
}
free
(
fs
->
properties
);
XFree
(
fs
);
SAFE_free
(
fs
->
properties
);
SAFE_XFree
(
fs
);
return
1
;
}
...
...
@@ -1769,7 +1758,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
MakeScalableFontNameError:
free
(
scalableFontName
);
SAFE_
free
(
scalableFontName
);
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentMakeScalableFontName: Invalid font name.
\n
"
);
...
...
nx-X11/programs/Xserver/hw/nxagent/GC.c
View file @
6f80a06f
...
...
@@ -61,6 +61,7 @@ is" without express or implied warranty.
#include "Trap.h"
#include "Screen.h"
#include "Pixels.h"
#include "Utils.h"
#include "../../fb/fb.h"
...
...
@@ -694,7 +695,7 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
XSetClipRectangles
(
nxagentDisplay
,
nxagentGC
(
pGC
),
pGC
->
clipOrg
.
x
,
pGC
->
clipOrg
.
y
,
pRects
,
nRects
,
Unsorted
);
free
((
char
*
)
pRects
);
SAFE_free
(
pRects
);
}
break
;
...
...
@@ -778,7 +779,7 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
pGC
->
clientClip
=
(
void
*
)
RegionFromRects
(
nRects
,
(
xRectangle
*
)
pValue
,
type
);
free
(
pValue
);
SAFE_
free
(
pValue
);
pValue
=
pGC
->
clientClip
;
...
...
@@ -912,9 +913,8 @@ static void nxagentFreeGCRec(struct nxagentGCRec *t)
(
void
*
)
t
,
(
void
*
)
t
->
gc
);
#endif
free
(
t
->
gc
);
free
(
t
);
SAFE_free
(
t
->
gc
);
SAFE_free
(
t
);
}
static
void
nxagentRestoreGCRec
(
struct
nxagentGCRec
*
t
)
...
...
@@ -924,11 +924,11 @@ static void nxagentRestoreGCRec(struct nxagentGCRec *t)
(
void
*
)
t
,
(
void
*
)
t
->
gc
);
#endif
free
(
nxagentGC
(
t
->
pGC
));
SAFE_
free
(
nxagentGC
(
t
->
pGC
));
nxagentGC
(
t
->
pGC
)
=
t
->
gc
;
free
(
t
);
SAFE_
free
(
t
);
}
static
void
nxagentAddGCToList
(
GCPtr
pGC
)
...
...
@@ -1303,7 +1303,7 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
XSetClipRectangles
(
nxagentDisplay
,
nxagentGC
(
pGC
),
pGC
->
clipOrg
.
x
,
pGC
->
clipOrg
.
y
,
pRects
,
nRects
,
Unsorted
);
free
((
char
*
)
pRects
);
SAFE_free
(
pRects
);
}
else
{
...
...
@@ -1374,7 +1374,7 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
pGC
->
clientClip
=
(
void
*
)
RegionFromRects
(
nRects
,
(
xRectangle
*
)
pValue
,
type
);
free
(
pValue
);
SAFE_
free
(
pValue
);
pValue
=
pGC
->
clientClip
;
type
=
CT_REGION
;
...
...
nx-X11/programs/Xserver/hw/nxagent/GCOps.c
View file @
6f80a06f
...
...
@@ -57,6 +57,7 @@ is" without express or implied warranty.
#include "Holder.h"
#include "Args.h"
#include "Screen.h"
#include "Utils.h"
#include "compext/Compext.h"
...
...
@@ -787,7 +788,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
srcx
,
srcy
,
width
,
height
);
#endif
free
(
data
);
SAFE_
free
(
data
);
/*
* If the source is a shared memory pixmap, the
...
...
@@ -1007,7 +1008,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
srcx
,
srcy
,
width
,
height
);
#endif
free
(
data
);
SAFE_
free
(
data
);
/*
* If the source is a shared memory pixmap, the
...
...
@@ -1545,7 +1546,7 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
RESET_GC_TRAP
();
}
free
(
newPoints
);
SAFE_
free
(
newPoints
);
}
void
nxagentPolyFillRect
(
DrawablePtr
pDrawable
,
GCPtr
pGC
,
...
...
nx-X11/programs/Xserver/hw/nxagent/Image.c
View file @
6f80a06f
...
...
@@ -455,7 +455,7 @@ FIXME: Here the split trap is always set and so the caching of
if
(
nxagentUnpackAlpha
[
resource
]
!=
NULL
)
{
free
(
nxagentUnpackAlpha
[
resource
]
->
data
);
SAFE_
free
(
nxagentUnpackAlpha
[
resource
]
->
data
);
}
else
if
((
nxagentUnpackAlpha
[
resource
]
=
malloc
(
sizeof
(
UnpackAlphaRec
)))
==
NULL
)
{
...
...
@@ -463,7 +463,7 @@ FIXME: Here the split trap is always set and so the caching of
fprintf
(
stderr
,
"nxagentSetUnpackAlpha: PANIC! Can't allocate data for the alpha structure.
\n
"
);
#endif
free
(
data
);
SAFE_
free
(
data
);
return
;
}
...
...
@@ -483,7 +483,7 @@ FIXME: Here the split trap is always set and so the caching of
resource
,
size
);
#endif
free
(
data
);
SAFE_
free
(
data
);
}
}
...
...
@@ -1567,20 +1567,20 @@ nxagentPutSubImageEnd:
nxagentImageStatistics
.
totalEncoded
,
nxagentImageStatistics
.
totalAdded
);
#endif
free
(
packedChecksum
);
SAFE_
free
(
packedChecksum
);
if
(
packedImage
!=
NULL
)
{
if
(
packedImage
->
data
!=
NULL
&&
packedImage
->
data
!=
plainImage
->
data
)
{
free
(
packedImage
->
data
);
SAFE_
free
(
packedImage
->
data
);
}
free
(
packedImage
);
SAFE_
free
(
packedImage
);
}
free
(
plainImage
);
SAFE_
free
(
plainImage
);
}
void
nxagentGetImage
(
DrawablePtr
pDrawable
,
int
x
,
int
y
,
int
w
,
int
h
,
...
...
@@ -1634,11 +1634,8 @@ void nxagentResetAlphaCache(void)
{
if
(
nxagentUnpackAlpha
[
i
])
{
free
(
nxagentUnpackAlpha
[
i
]
->
data
);
free
(
nxagentUnpackAlpha
[
i
]);
nxagentUnpackAlpha
[
i
]
=
NULL
;
SAFE_free
(
nxagentUnpackAlpha
[
i
]
->
data
);
SAFE_free
(
nxagentUnpackAlpha
[
i
]);
}
}
}
...
...
@@ -1716,7 +1713,7 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio,
if
(
newImage
->
data
==
NULL
)
{
free
(
newImage
);
SAFE_
free
(
newImage
);
#ifdef PANIC
fprintf
(
stderr
,
"nxagentScaleImage: PANIC! Failed to create the target image data.
\n
"
);
...
...
@@ -1784,8 +1781,8 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio,
}
}
free
((
char
*
)
image
->
obdata
);
free
((
char
*
)
image
);
SAFE_free
(
image
->
obdata
);
SAFE_free
(
image
);
*
pImage
=
newImage
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
View file @
6f80a06f
...
...
@@ -58,6 +58,7 @@ is" without express or implied warranty.
#include "Options.h"
#include "Error.h"
#include "Init.h"
#include "Utils.h"
#include "compext/Compext.h"
...
...
@@ -657,7 +658,7 @@ N/A
{
keymap
[
i
]
=
keymap64
[
i
];
}
XFree
(
keymap64
);
SAFE_
XFree
(
keymap64
);
}
#else
/* #ifdef _XSERVER64 */
...
...
@@ -762,7 +763,7 @@ XkbError:
#ifdef TEST
fprintf
(
stderr
,
"%s: changing nxagentKeyboard from [null/null] to [clone].
\n
"
,
__func__
);
#endif
free
(
nxagentKeyboard
);
SAFE_
free
(
nxagentKeyboard
);
nxagentKeyboard
=
strdup
(
"clone"
);
}
...
...
@@ -809,7 +810,7 @@ XkbError:
layout
=
strdup
(
strsep
(
&
tmp
,
sep
));
variant
=
strdup
(
strsep
(
&
tmp
,
sep
));
options
=
strdup
(
strsep
(
&
tmp
,
sep
));
free
(
rmlvo
);
SAFE_
free
(
rmlvo
);
}
else
{
...
...
@@ -864,11 +865,11 @@ XkbError:
/* Only setup keycode conversion if we are NOT in clone mode */
if
(
nxagentKeyboard
&&
(
strcmp
(
nxagentKeyboard
,
"clone"
)
==
0
))
{
free
(
rules
);
rules
=
strdup
(
nxagentRemoteRules
);
free
(
model
);
model
=
strdup
(
nxagentRemoteModel
);
free
(
layout
);
layout
=
strdup
(
nxagentRemoteLayout
);
free
(
variant
);
variant
=
strdup
(
nxagentRemoteVariant
);
free
(
options
);
options
=
strdup
(
nxagentRemoteOptions
);
SAFE_
free
(
rules
);
rules
=
strdup
(
nxagentRemoteRules
);
SAFE_
free
(
model
);
model
=
strdup
(
nxagentRemoteModel
);
SAFE_
free
(
layout
);
layout
=
strdup
(
nxagentRemoteLayout
);
SAFE_
free
(
variant
);
variant
=
strdup
(
nxagentRemoteVariant
);
SAFE_
free
(
options
);
options
=
strdup
(
nxagentRemoteOptions
);
/*
* when cloning we do not want X2Go to set the keyboard
* via a keyboard file generated by nxagent. The defined
...
...
@@ -947,9 +948,9 @@ XkbError:
NXShadowInitKeymap
(
&
(
pDev
->
key
->
curKeySyms
));
}
free
(
rules
);
free
(
variant
);
free
(
options
);
SAFE_
free
(
rules
);
SAFE_
free
(
variant
);
SAFE_
free
(
options
);
}
if
(
xkb
)
...
...
@@ -958,8 +959,8 @@ XkbError:
xkb
=
NULL
;
}
free
(
model
);
free
(
layout
);
SAFE_
free
(
model
);
SAFE_
free
(
layout
);
#endif
#ifdef WATCH
...
...
@@ -980,9 +981,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
#endif
#ifdef _XSERVER64
free
(
keymap
);
SAFE_
free
(
keymap
);
#else
XFree
(
keymap
);
SAFE_
XFree
(
keymap
);
#endif
break
;
case
DEVICE_ON
:
...
...
@@ -1182,7 +1183,7 @@ int nxagentResetKeyboard(void)
nxagentFreeKeyboardDeviceData
(
devBackup
);
free
(
devBackup
);
SAFE_
free
(
devBackup
);
return
1
;
}
...
...
@@ -1315,18 +1316,15 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
}
#endif
free
(
dev
->
key
->
curKeySyms
.
map
);
free
(
dev
->
key
->
modifierKeyMap
);
free
(
dev
->
key
);
dev
->
key
=
NULL
;
SAFE_free
(
dev
->
key
->
curKeySyms
.
map
);
SAFE_free
(
dev
->
key
->
modifierKeyMap
);
SAFE_free
(
dev
->
key
);
}
if
(
dev
->
focus
)
{
free
(
dev
->
focus
->
trace
);
free
(
dev
->
focus
);
dev
->
focus
=
NULL
;
SAFE_free
(
dev
->
focus
->
trace
);
SAFE_free
(
dev
->
focus
);
}
if
(
dev
->
kbdfeed
)
...
...
@@ -1338,7 +1336,7 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
if
(
k
->
xkb_sli
)
XkbFreeSrvLedInfo
(
k
->
xkb_sli
);
#endif
free
(
k
);
SAFE_
free
(
k
);
}
dev
->
kbdfeed
=
NULL
;
}
...
...
@@ -1571,11 +1569,11 @@ void nxagentTuneXkbWrapper(void)
void
nxagentXkbClearNames
(
void
)
{
free
(
nxagentRemoteRules
);
nxagentRemoteRules
=
NULL
;
free
(
nxagentRemoteModel
);
nxagentRemoteModel
=
NULL
;
free
(
nxagentRemoteLayout
);
nxagentRemoteLayout
=
NULL
;
free
(
nxagentRemoteVariant
);
nxagentRemoteVariant
=
NULL
;
free
(
nxagentRemoteOptions
);
nxagentRemoteOptions
=
NULL
;
SAFE_free
(
nxagentRemoteRules
)
;
SAFE_free
(
nxagentRemoteModel
)
;
SAFE_free
(
nxagentRemoteLayout
)
;
SAFE_free
(
nxagentRemoteVariant
)
;
SAFE_free
(
nxagentRemoteOptions
)
;
}
static
void
nxagentXkbGetNames
(
void
)
...
...
@@ -1618,7 +1616,7 @@ static void nxagentXkbGetNames(void)
{
if
(
data
)
{
XFree
(
data
);
SAFE_
XFree
(
data
);
return
;
}
}
...
...
@@ -1655,7 +1653,7 @@ static void nxagentXkbGetNames(void)
name
+=
strlen
(
name
)
+
1
;
}
XFree
(
data
);
SAFE_
XFree
(
data
);
return
;
}
...
...
@@ -1686,12 +1684,12 @@ static char* getKeyboardFilePath(void)
{
if
((
asprintf
(
&
keyboard_file_path
,
"%s/keyboard"
,
sessionpath
)
==
-
1
))
{
free
(
sessionpath
);
SAFE_
free
(
sessionpath
);
FatalError
(
"malloc for keyboard file path failed."
);
}
else
{
free
(
sessionpath
);
SAFE_
free
(
sessionpath
);
}
}
else
...
...
@@ -1720,7 +1718,7 @@ static void nxagentWriteKeyboardDir(void)
{
fprintf
(
stderr
,
"Info: keyboard blocking directory created: '%s'
\n
"
,
keyboard_file_path
);
}
free
(
keyboard_file_path
);
SAFE_
free
(
keyboard_file_path
);
}
}
...
...
@@ -1748,7 +1746,7 @@ static void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, cha
int
save_err
=
errno
;
fprintf
(
stderr
,
"Error: keyboard file not created: %s
\n
"
,
strerror
(
save_err
));
}
free
(
keyboard_file_path
);
SAFE_
free
(
keyboard_file_path
);
}
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
View file @
6f80a06f
...
...
@@ -294,7 +294,7 @@ void nxagentInitKeystrokes(Bool force)
if
(
force
)
{
if
(
map
!=
default_map
)
{
free
(
map
);
SAFE_
free
(
map
);
map
=
default_map
;
}
fprintf
(
stderr
,
"Info: re-reading keystrokes configuration
\n
"
);
...
...
@@ -414,7 +414,7 @@ void nxagentInitKeystrokes(Bool force)
#endif
filename
=
NULL
;
}
free
(
homepath
);
SAFE_
free
(
homepath
);
if
(
map
==
default_map
)
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
View file @
6f80a06f
...
...
@@ -49,6 +49,7 @@
#include "Events.h"
#include "Holder.h"
#include "Args.h"
#include "Utils.h"
#include "compext/Compext.h"
#include <nx/NXpack.h>
...
...
@@ -501,7 +502,7 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap)
FreeResource
(
pPixmapPriv
->
mid
,
RT_NONE
);
}
free
(
pPixmap
);
SAFE_
free
(
pPixmap
);
return
True
;
}
...
...
@@ -1092,7 +1093,7 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
{
FatalError
(
"XGetImage: Failed.
\n
"
);
free
(
data
);
SAFE_
free
(
data
);
return
False
;
}
...
...
@@ -1168,7 +1169,7 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
XDestroyImage
(
image
);
}
free
(
data
);
SAFE_
free
(
data
);
}
else
{
...
...
@@ -1265,7 +1266,7 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
nxagentPutImage
(
pDrawable
,
pGC
,
depth
,
xPict
,
yPict
,
width
,
height
,
0
,
format
,
data
);
free
(
data
);
SAFE_
free
(
data
);
}
#ifdef WARNING
else
...
...
@@ -1413,7 +1414,7 @@ FIXME: If the pixmap has a different depth from the window, the
fprintf
(
stderr
,
"nxagentPixmapOnShadowDisplay: XCreateImage failed.
\n
"
);
#endif
free
(
data
);
SAFE_
free
(
data
);
return
False
;
}
...
...
@@ -1572,7 +1573,7 @@ Bool nxagentFbOnShadowDisplay(void)
fprintf
(
stderr
,
"nxagentFbOnShadowDisplay: XCreateImage failed.
\n
"
);
#endif
free
(
data
);
SAFE_
free
(
data
);
return
False
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
6f80a06f
...
...
@@ -53,6 +53,7 @@
#include "Splash.h"
#include "Error.h"
#include "Keystroke.h"
#include "Utils.h"
#ifdef XKB
#include "XKBsrv.h"
...
...
@@ -448,8 +449,7 @@ Bool nxagentReconnectSession(void)
return
0
;
}
free
(
nxagentKeyboard
);
nxagentKeyboard
=
NULL
;
SAFE_free
(
nxagentKeyboard
);
}
nxagentSaveOptions
();
...
...
@@ -464,7 +464,7 @@ Bool nxagentReconnectSession(void)
fprintf
(
stderr
,
"nxagentReconnect: changing nxagentKeyboard from [null/null] to [clone].
\n
"
);
#endif
free
(
nxagentKeyboard
);
SAFE_
free
(
nxagentKeyboard
);
nxagentKeyboard
=
strdup
(
"clone"
);
}
...
...
@@ -635,8 +635,7 @@ Bool nxagentReconnectSession(void)
nxagentXkbState
.
Initialized
=
0
;
free
(
nxagentOldKeyboard
);
nxagentOldKeyboard
=
NULL
;
SAFE_free
(
nxagentOldKeyboard
);
nxagentInitPointerMap
();
...
...
@@ -760,8 +759,7 @@ nxagentReconnectError:
nxagentDisconnectDisplay
();
}
free
(
nxagentOldKeyboard
);
nxagentOldKeyboard
=
NULL
;
SAFE_free
(
nxagentOldKeyboard
);
return
0
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Render.c
View file @
6f80a06f
...
...
@@ -45,6 +45,7 @@
#include "Drawable.h"
#include "Trap.h"
#include "Args.h"
#include "Utils.h"
#define Atom XlibAtom
#define Pixmap XlibPixmap
...
...
@@ -2528,7 +2529,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
if
(
normalizedImages
!=
images
)
{
free
(
normalizedImages
);
SAFE_
free
(
normalizedImages
);
}
#ifdef DEBUG
...
...
@@ -2636,7 +2637,7 @@ FIXME: Is this useful or just a waste of bandwidth?
nparams
);
#endif
free
(
szFilter
);
SAFE_
free
(
szFilter
);
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Rootless.c
View file @
6f80a06f
...
...
@@ -281,10 +281,7 @@ Bool nxagentRootlessTreesMatch(void)
}
}
if
(
children_return
)
{
XFree
(
children_return
);
}
SAFE_XFree
(
children_return
);
return
treesMatch
;
}
...
...
@@ -332,7 +329,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
if
(
!
ntoplevel
)
{
free
(
toplevel
);
SAFE_
free
(
toplevel
);
return
;
}
...
...
@@ -397,7 +394,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
#endif
free
(
toplevel
);
SAFE_
free
(
toplevel
);
return
;
}
...
...
@@ -818,7 +815,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
if
(
freeMem
)
{
free
(
output
);
SAFE_
free
(
output
);
}
return
export
;
...
...
@@ -1131,7 +1128,7 @@ void nxagentImportProperty(Window window,
if
(
freeMem
)
{
free
(
output
);
SAFE_
free
(
output
);
}
return
;
...
...
@@ -1183,7 +1180,7 @@ void nxagentRemovePropertyFromList(void)
nxagentPropertyList
.
last
=
NULL
;
}
free
(
tmp
);
SAFE_
free
(
tmp
);
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
6f80a06f
...
...
@@ -302,8 +302,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
);
...
...
@@ -484,11 +483,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.
...
...
@@ -889,10 +885,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
,
...
...
@@ -1387,7 +1382,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
if
(
!
pFrameBufferBits
)
{
freeDepths
(
depths
,
numDepths
);
free
(
visuals
);
SAFE_
free
(
visuals
);
return
FALSE
;
}
...
...
@@ -1410,7 +1405,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
monitorResolution
,
monitorResolution
,
PixmapBytePad
(
nxagentOption
(
RootWidth
),
rootDepth
),
bitsPerPixel
))
{
freeDepths
(
depths
,
numDepths
);
free
(
visuals
);
SAFE_
free
(
visuals
);
return
FALSE
;
}
...
...
@@ -1451,7 +1446,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
;
...
...
@@ -1892,8 +1887,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
))
...
...
@@ -1977,17 +1972,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
...
...
@@ -2199,9 +2185,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
);
...
...
@@ -3158,7 +3144,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
length
=
nxagentImageLength
(
width
,
height
,
ZPixmap
,
0
,
nxagentMasterDepth
);
free
(
tBuffer
);
SAFE_
free
(
tBuffer
);
tBuffer
=
malloc
(
length
);
...
...
@@ -3215,7 +3201,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
RegionUnion
(
&
nxagentShadowUpdateRegion
,
&
nxagentShadowUpdateRegion
,
&
updateRegion
);
}
free
(
tBuffer
);
SAFE_
free
(
tBuffer
);
RegionUninit
(
&
updateRegion
);
}
...
...
@@ -3433,7 +3419,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
cBuffer
=
(
unsigned
char
*
)
*
buffer
;
*
buffer
=
(
char
*
)
icBuffer
;
free
(
cBuffer
);
SAFE_
free
(
cBuffer
);
}
#ifdef NXAGENT_ARTSD
...
...
@@ -3616,7 +3602,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
);
}
}
}
...
...
@@ -4040,7 +4026,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#endif
number
=
1
;
free
(
screeninfo
);
SAFE_
free
(
screeninfo
);
if
(
!
(
screeninfo
=
malloc
(
sizeof
(
XineramaScreenInfo
))))
{
return
FALSE
;
...
...
@@ -4309,8 +4295,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
}
/* release allocated memory */
free
(
screeninfo
);
screeninfo
=
NULL
;
SAFE_free
(
screeninfo
);
#ifdef DEBUG
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
...
...
@@ -4425,7 +4410,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
);
...
...
@@ -4571,7 +4556,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
);
...
...
@@ -4651,7 +4636,7 @@ void nxagentSetWMNormalHints(int screen, int width, int height)
XSetWMNormalHints
(
nxagentDisplay
,
nxagentDefaultWindows
[
screen
],
sizeHints
);
XFree
(
sizeHints
);
SAFE_
XFree
(
sizeHints
);
}
/*
...
...
@@ -4670,7 +4655,7 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheig
sizeHints
->
max_height
=
maxheight
;
XSetWMNormalHints
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
sizeHints
);
XFree
(
sizeHints
);
SAFE_
XFree
(
sizeHints
);
}
}
...
...
@@ -4811,7 +4796,7 @@ FIXME
fprintf
(
stderr
,
"nxagentShowPixmap: XGetImage failed.
\n
"
);
#endif
free
(
data
);
SAFE_
free
(
data
);
return
;
}
...
...
@@ -4844,7 +4829,7 @@ FIXME
XDestroyImage
(
image
);
}
free
(
data
);
SAFE_
free
(
data
);
/*
FIXME
...
...
@@ -4896,7 +4881,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
fprintf
(
stderr
,
"nxagentFbRestoreArea: XGetImage failed.
\n
"
);
#endif
free
(
data
);
SAFE_
free
(
data
);
return
;
}
...
...
@@ -4956,7 +4941,7 @@ FIXME
/*
FIXME
free(data);
SAFE_
free(data);
*/
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Utils.h
View file @
6f80a06f
...
...
@@ -45,5 +45,6 @@ static inline const char * validateString(const char *str) {
}
#define SAFE_XFree(what) do {if (what) {XFree(what); what = NULL;}} while (0)
#define SAFE_free(what) do {free(what); what = NULL;} while (0)
#endif
/* __Utils_H__ */
nx-X11/programs/Xserver/hw/nxagent/Window.c
View file @
6f80a06f
...
...
@@ -63,6 +63,7 @@
#include "Init.h"
#include "Composite.h"
#include "Events.h"
#include "Utils.h"
#include <nx/NX.h>
#include "compext/Compext.h"
...
...
@@ -1430,10 +1431,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
fprintf
(
stderr
,
"nxagentConfigureWindow: Failed QueryTree request.
\n
"
);
}
if
(
children_return
)
{
XFree
(
children_return
);
}
SAFE_XFree
(
children_return
);
}
#endif
}
...
...
@@ -3129,7 +3127,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
&
hints
);
#ifdef _XSERVER64
free
(
data64
);
SAFE_
free
(
data64
);
#endif
}
}
...
...
@@ -3376,7 +3374,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin)
XDestroyImage
(
image
);
}
free
(
data
);
SAFE_
free
(
data
);
}
else
{
...
...
@@ -3465,14 +3463,14 @@ void nxagentFlushConfigureWindow(void)
if
(
index
==
nxagentConfiguredWindowList
)
{
free
(
index
);
SAFE_
free
(
index
);
break
;
}
else
{
ConfiguredWindowStruct
*
tmp
=
index
;
index
=
index
->
prev
;
free
(
tmp
);
SAFE_
free
(
tmp
);
}
}
...
...
@@ -3622,16 +3620,14 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
{
if
(
index
->
prev
==
NULL
&&
index
->
next
==
NULL
)
{
free
(
nxagentConfiguredWindowList
);
nxagentConfiguredWindowList
=
NULL
;
SAFE_free
(
nxagentConfiguredWindowList
);
return
;
}
else
if
(
index
->
prev
==
NULL
)
{
tmp
=
nxagentConfiguredWindowList
;
index
=
nxagentConfiguredWindowList
=
tmp
->
next
;
free
(
tmp
);
SAFE_
free
(
tmp
);
nxagentConfiguredWindowList
->
prev
=
NULL
;
continue
;
...
...
@@ -3640,7 +3636,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
{
tmp
=
index
;
index
=
index
->
prev
;
free
(
tmp
);
SAFE_
free
(
tmp
);
index
->
next
=
NULL
;
return
;
...
...
@@ -3651,7 +3647,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
index
=
index
->
next
;
previous
->
next
=
index
;
index
->
prev
=
previous
;
free
(
tmp
);
SAFE_
free
(
tmp
);
continue
;
}
...
...
@@ -3693,16 +3689,14 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
{
if
(
index
->
prev
==
NULL
&&
index
->
next
==
NULL
)
{
free
(
nxagentStaticResizedWindowList
);
nxagentStaticResizedWindowList
=
NULL
;
SAFE_free
(
nxagentStaticResizedWindowList
);
return
;
}
else
if
(
index
->
prev
==
NULL
)
{
tmp
=
nxagentStaticResizedWindowList
;
index
=
nxagentStaticResizedWindowList
=
tmp
->
next
;
free
(
tmp
);
SAFE_
free
(
tmp
);
nxagentStaticResizedWindowList
->
prev
=
NULL
;
continue
;
...
...
@@ -3711,7 +3705,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
{
tmp
=
index
;
index
=
index
->
prev
;
free
(
tmp
);
SAFE_
free
(
tmp
);
index
->
next
=
NULL
;
return
;
...
...
@@ -3722,7 +3716,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
index
=
index
->
next
;
previous
->
next
=
index
;
index
->
prev
=
previous
;
free
(
tmp
);
SAFE_
free
(
tmp
);
continue
;
}
...
...
@@ -3855,8 +3849,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId)
if
((
nxagentBSPixmapList
[
i
]
!=
NULL
)
&&
(
nxagentBSPixmapList
[
i
]
->
storingPixmapId
==
pixmapId
))
{
free
(
nxagentBSPixmapList
[
i
]);
nxagentBSPixmapList
[
i
]
=
NULL
;
SAFE_free
(
nxagentBSPixmapList
[
i
]);
if
(
i
<
BSPIXMAPLIMIT
-
1
)
{
...
...
@@ -3894,8 +3887,7 @@ int nxagentEmptyBSPixmapList(void)
{
for
(
int
i
=
0
;
i
<
BSPIXMAPLIMIT
;
i
++
)
{
free
(
nxagentBSPixmapList
[
i
]);
nxagentBSPixmapList
[
i
]
=
NULL
;
SAFE_free
(
nxagentBSPixmapList
[
i
]);
}
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment