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
7e975e3c
Commit
7e975e3c
authored
Nov 18, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simply free() calls
free() can handle NULL so there's no need to check this ourselves
parent
3b640a0f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
50 additions
and
154 deletions
+50
-154
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+2
-6
Clipboard.c
nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+4
-10
Colormap.c
nx-X11/programs/Xserver/hw/nxagent/Colormap.c
+3
-5
Drawable.c
nx-X11/programs/Xserver/hw/nxagent/Drawable.c
+8
-20
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+7
-22
GC.c
nx-X11/programs/Xserver/hw/nxagent/GC.c
+1
-4
GCOps.c
nx-X11/programs/Xserver/hw/nxagent/GCOps.c
+1
-4
Image.c
nx-X11/programs/Xserver/hw/nxagent/Image.c
+2
-9
Pixmap.c
nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
+3
-12
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+4
-12
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+11
-35
Window.c
nx-X11/programs/Xserver/hw/nxagent/Window.c
+4
-15
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
7e975e3c
...
...
@@ -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
)
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
View file @
7e975e3c
...
...
@@ -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
));
...
...
nx-X11/programs/Xserver/hw/nxagent/Colormap.c
View file @
7e975e3c
...
...
@@ -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
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Drawable.c
View file @
7e975e3c
...
...
@@ -264,7 +264,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success
=
0
;
goto
nxagentSynchronizeDrawableData
Free
;
goto
nxagentSynchronizeDrawableData
End
;
}
ValidateGC
(
pDrawable
,
pGC
);
...
...
@@ -282,7 +282,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success
=
1
;
goto
nxagentSynchronizeDrawableData
Free
;
goto
nxagentSynchronizeDrawableData
End
;
}
else
if
(
nxagentReconnectTrap
==
1
)
{
...
...
@@ -323,7 +323,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success
=
0
;
goto
nxagentSynchronizeDrawableData
Free
;
goto
nxagentSynchronizeDrawableData
End
;
}
ValidateGC
(
pDrawable
,
pGC
);
...
...
@@ -336,7 +336,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success
=
1
;
goto
nxagentSynchronizeDrawableData
Free
;
goto
nxagentSynchronizeDrawableData
End
;
}
else
{
...
...
@@ -349,7 +349,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
success
=
1
;
goto
nxagentSynchronizeDrawableData
Free
;
goto
nxagentSynchronizeDrawableData
End
;
}
}
}
...
...
@@ -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
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
7e975e3c
...
...
@@ -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
);
...
...
nx-X11/programs/Xserver/hw/nxagent/GC.c
View file @
7e975e3c
...
...
@@ -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
;
...
...
nx-X11/programs/Xserver/hw/nxagent/GCOps.c
View file @
7e975e3c
...
...
@@ -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
,
...
...
nx-X11/programs/Xserver/hw/nxagent/Image.c
View file @
7e975e3c
...
...
@@ -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
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
View file @
7e975e3c
...
...
@@ -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
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
7e975e3c
...
...
@@ -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
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
7e975e3c
...
...
@@ -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);
*/
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Window.c
View file @
7e975e3c
...
...
@@ -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
;
...
...
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