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
a4700c9d
Commit
a4700c9d
authored
Jul 22, 2019
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Font.c: use SAFE_XFree and SAFE_free
parent
d8012d2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
37 deletions
+26
-37
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+26
-37
No files found.
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
a4700c9d
...
@@ -188,11 +188,11 @@ void nxagentFreeFontCache(void)
...
@@ -188,11 +188,11 @@ void nxagentFreeFontCache(void)
nxagentFreeFont
(
CACHE_FSTRUCT
(
i
));
nxagentFreeFont
(
CACHE_FSTRUCT
(
i
));
}
}
free
(
CACHE_NAME
(
i
));
SAFE_
free
(
CACHE_NAME
(
i
));
free
(
CACHE_ENTRY
(
i
));
SAFE_
free
(
CACHE_ENTRY
(
i
));
}
}
free
(
CACHE_ENTRY_PTR
);
SAFE_
free
(
CACHE_ENTRY_PTR
);
CACHE_ENTRY_PTR
=
NULL
;
CACHE_ENTRY_PTR
=
NULL
;
CACHE_INDEX
=
0
;
CACHE_INDEX
=
0
;
CACHE_SIZE
=
0
;
CACHE_SIZE
=
0
;
...
@@ -324,8 +324,7 @@ void nxagentListRemoteAddName(const char *name, int status)
...
@@ -324,8 +324,7 @@ void nxagentListRemoteAddName(const char *name, int status)
if
(
nxagentRemoteFontList
.
list
[
pos
]
->
name
==
NULL
)
if
(
nxagentRemoteFontList
.
list
[
pos
]
->
name
==
NULL
)
{
{
fprintf
(
stderr
,
"Font: remote list name memory allocation failed!.
\n
"
);
fprintf
(
stderr
,
"Font: remote list name memory allocation failed!.
\n
"
);
free
(
nxagentRemoteFontList
.
list
[
pos
]);
SAFE_free
(
nxagentRemoteFontList
.
list
[
pos
]);
nxagentRemoteFontList
.
list
[
pos
]
=
NULL
;
return
;
return
;
}
}
}
}
...
@@ -351,18 +350,14 @@ static void nxagentFreeRemoteFontList(nxagentFontList *listRec)
...
@@ -351,18 +350,14 @@ static void nxagentFreeRemoteFontList(nxagentFontList *listRec)
{
{
if
(
listRec
->
list
[
l
])
if
(
listRec
->
list
[
l
])
{
{
free
(
listRec
->
list
[
l
]
->
name
);
SAFE_free
(
listRec
->
list
[
l
]
->
name
);
listRec
->
list
[
l
]
->
name
=
NULL
;
SAFE_free
(
listRec
->
list
[
l
]);
free
(
listRec
->
list
[
l
]);
listRec
->
list
[
l
]
=
NULL
;
}
}
}
}
listRec
->
length
=
listRec
->
listSize
=
0
;
listRec
->
length
=
listRec
->
listSize
=
0
;
free
(
listRec
->
list
);
SAFE_free
(
listRec
->
list
);
listRec
->
list
=
NULL
;
return
;
return
;
}
}
...
@@ -434,7 +429,7 @@ Bool nxagentFontLookUp(const char *name)
...
@@ -434,7 +429,7 @@ Bool nxagentFontLookUp(const char *name)
{
{
result
=
nxagentFontFind
(
scalable
,
&
i
);
result
=
nxagentFontFind
(
scalable
,
&
i
);
free
(
scalable
);
SAFE_
free
(
scalable
);
}
}
}
}
...
@@ -448,7 +443,7 @@ Bool nxagentFontLookUp(const char *name)
...
@@ -448,7 +443,7 @@ Bool nxagentFontLookUp(const char *name)
{
{
result
=
nxagentFontFind
(
scalable
,
&
i
);
result
=
nxagentFontFind
(
scalable
,
&
i
);
free
(
scalable
);
SAFE_
free
(
scalable
);
}
}
}
}
...
@@ -813,7 +808,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
...
@@ -813,7 +808,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
for
(
j
=
0
;
j
<
numSearchFields
;
j
++
)
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
...
@@ -830,7 +825,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
for
(
j
=
0
;
j
<
numFontFields
;
j
++
)
for
(
j
=
0
;
j
<
numFontFields
;
j
++
)
{
{
free
(
fontNameFields
[
j
]);
SAFE_
free
(
fontNameFields
[
j
]);
}
}
return
fontStruct
;
return
fontStruct
;
...
@@ -890,10 +885,8 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
...
@@ -890,10 +885,8 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
if
(
nxagentFailedToReconnectFonts
.
font
==
NULL
||
nxagentFailedToReconnectFonts
.
id
==
NULL
)
if
(
nxagentFailedToReconnectFonts
.
font
==
NULL
||
nxagentFailedToReconnectFonts
.
id
==
NULL
)
{
{
free
(
nxagentFailedToReconnectFonts
.
font
);
SAFE_free
(
nxagentFailedToReconnectFonts
.
font
);
nxagentFailedToReconnectFonts
.
font
=
NULL
;
SAFE_free
(
nxagentFailedToReconnectFonts
.
id
);
free
(
nxagentFailedToReconnectFonts
.
id
);
nxagentFailedToReconnectFonts
.
id
=
NULL
;
FatalError
(
"Font: font not reconnected memory allocation failed!.
\n
"
);
FatalError
(
"Font: font not reconnected memory allocation failed!.
\n
"
);
}
}
...
@@ -1050,7 +1043,7 @@ static void nxagentCleanCacheAfterReconnect(void)
...
@@ -1050,7 +1043,7 @@ static void nxagentCleanCacheAfterReconnect(void)
{
{
if
(
CACHE_FSTRUCT
(
i
)
==
NULL
)
if
(
CACHE_FSTRUCT
(
i
)
==
NULL
)
{
{
XFree
(
CACHE_NAME
(
i
));
SAFE_
XFree
(
CACHE_NAME
(
i
));
real_size
--
;
real_size
--
;
}
}
}
}
...
@@ -1223,11 +1216,8 @@ static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2)
...
@@ -1223,11 +1216,8 @@ static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2)
static
void
nxagentFreeFailedToReconnectFonts
(
void
)
static
void
nxagentFreeFailedToReconnectFonts
(
void
)
{
{
free
(
nxagentFailedToReconnectFonts
.
font
);
SAFE_free
(
nxagentFailedToReconnectFonts
.
font
);
nxagentFailedToReconnectFonts
.
font
=
NULL
;
SAFE_free
(
nxagentFailedToReconnectFonts
.
id
);
free
(
nxagentFailedToReconnectFonts
.
id
);
nxagentFailedToReconnectFonts
.
id
=
NULL
;
nxagentFailedToReconnectFonts
.
size
=
0
;
nxagentFailedToReconnectFonts
.
size
=
0
;
nxagentFailedToReconnectFonts
.
index
=
0
;
nxagentFailedToReconnectFonts
.
index
=
0
;
...
@@ -1321,7 +1311,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
...
@@ -1321,7 +1311,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
nxagentListRemoteFonts
(
"*"
,
nxagentMaxFontNames
);
nxagentListRemoteFonts
(
"*"
,
nxagentMaxFontNames
);
XFreeFontPath
(
fontPaths
);
XFreeFontPath
(
fontPaths
);
free
(
newFontPaths
);
SAFE_
free
(
newFontPaths
);
return
False
;
return
False
;
}
}
...
@@ -1332,7 +1322,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
...
@@ -1332,7 +1322,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
XSetFontPath
(
nxagentDisplay
,
fontPaths
,
nPaths
);
XSetFontPath
(
nxagentDisplay
,
fontPaths
,
nPaths
);
XFreeFontPath
(
fontPaths
);
XFreeFontPath
(
fontPaths
);
free
(
newFontPaths
);
SAFE_
free
(
newFontPaths
);
nxagentCleanCacheAfterReconnect
();
nxagentCleanCacheAfterReconnect
();
...
@@ -1442,7 +1432,7 @@ void nxagentVerifySingleFontPath(char **dest, const char *fontDir)
...
@@ -1442,7 +1432,7 @@ void nxagentVerifySingleFontPath(char **dest, const char *fontDir)
if
(
rc
==
-
1
)
if
(
rc
==
-
1
)
return
;
return
;
free
(
*
dest
);
SAFE_
free
(
*
dest
);
*
dest
=
tmppath
;
*
dest
=
tmppath
;
tmppath
=
NULL
;
tmppath
=
NULL
;
}
}
...
@@ -1554,7 +1544,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
...
@@ -1554,7 +1544,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
fprintf
(
stderr
,
"nxagentLoadQueryFont: WARNING! Font not found '%s'.
\n
"
,
name
);
fprintf
(
stderr
,
"nxagentLoadQueryFont: WARNING! Font not found '%s'.
\n
"
,
name
);
#endif
#endif
free
(
fs
);
SAFE_
free
(
fs
);
return
(
XFontStruct
*
)
NULL
;
return
(
XFontStruct
*
)
NULL
;
}
}
...
@@ -1588,7 +1578,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
...
@@ -1588,7 +1578,7 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
fprintf
(
stderr
,
"nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."
);
fprintf
(
stderr
,
"nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."
);
#endif
#endif
free
((
char
*
)
fs
);
SAFE_free
(
fs
);
return
(
XFontStruct
*
)
NULL
;
return
(
XFontStruct
*
)
NULL
;
}
}
...
@@ -1622,18 +1612,17 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
...
@@ -1622,18 +1612,17 @@ XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFo
int
nxagentFreeFont
(
XFontStruct
*
fs
)
int
nxagentFreeFont
(
XFontStruct
*
fs
)
{
{
if
(
fs
->
per_char
)
if
(
fs
->
per_char
)
{
{
#ifdef USE_XF86BIGFONT
#ifdef USE_XF86BIGFONT
_XF86BigfontFreeFontMetrics
(
fs
);
_XF86BigfontFreeFontMetrics
(
fs
);
#else
#else
free
((
char
*
)
fs
->
per_char
);
SAFE_free
(
fs
->
per_char
);
#endif
#endif
}
}
free
(
fs
->
properties
);
SAFE_free
(
fs
->
properties
);
SAFE_XFree
(
fs
);
XFree
(
fs
);
return
1
;
return
1
;
}
}
...
@@ -1769,7 +1758,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
...
@@ -1769,7 +1758,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
MakeScalableFontNameError:
MakeScalableFontNameError:
free
(
scalableFontName
);
SAFE_
free
(
scalableFontName
);
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentMakeScalableFontName: Invalid font name.
\n
"
);
fprintf
(
stderr
,
"nxagentMakeScalableFontName: Invalid font name.
\n
"
);
...
...
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