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
bed0d6ce
Commit
bed0d6ce
authored
Jan 07, 2020
by
Ulrich Sibiller
Committed by
Mike Gabriel
May 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Atoms.c: always duplicate strings before storing them in privAtomMap
Otherwise we will never be able to free the list because we do not know if free() is allowed or not.
parent
8a5c1d3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
26 deletions
+11
-26
Atoms.c
nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+11
-26
No files found.
nx-X11/programs/Xserver/hw/nxagent/Atoms.c
View file @
bed0d6ce
...
...
@@ -374,7 +374,7 @@ static unsigned int privAtomMapSize = 0;
static
unsigned
int
privLastAtom
=
0
;
static
void
nxagentExpandCache
(
void
);
static
void
nxagentWriteAtom
(
Atom
,
XlibAtom
,
const
char
*
,
Bool
);
static
void
nxagentWriteAtom
(
Atom
,
XlibAtom
,
const
char
*
);
static
AtomMap
*
nxagentFindAtomByRemoteValue
(
XlibAtom
);
static
AtomMap
*
nxagentFindAtomByLocalValue
(
Atom
);
static
AtomMap
*
nxagentFindAtomByName
(
char
*
,
unsigned
);
...
...
@@ -396,31 +396,16 @@ static void nxagentExpandCache(void)
* consequent allocation, then cache the atom-couple.
*/
static
void
nxagentWriteAtom
(
Atom
local
,
XlibAtom
remote
,
const
char
*
string
,
Bool
duplicate
)
static
void
nxagentWriteAtom
(
Atom
local
,
XlibAtom
remote
,
const
char
*
string
)
{
const
char
*
s
;
const
char
*
s
=
strdup
(
string
)
;
/*
* We could remove this string duplication if we knew for sure that
* the server will not reset, since only at reset the dix layer
* frees all the atom names.
*/
if
(
duplicate
)
{
s
=
strdup
(
string
);
#ifdef WARNING
if
(
s
==
NULL
)
{
fprintf
(
stderr
,
"nxagentWriteAtom: Malloc failed.
\n
"
);
}
#endif
}
else
#ifdef WARNING
if
(
s
==
NULL
)
{
s
=
string
;
fprintf
(
stderr
,
"nxagentWriteAtom: Malloc failed.
\n
"
)
;
}
#endif
if
(
privLastAtom
==
privAtomMapSize
)
{
...
...
@@ -515,7 +500,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
if
(
ValidAtom
(
local
))
{
nxagentWriteAtom
(
local
,
atom_list
[
i
],
name_list
[
i
]
,
False
);
nxagentWriteAtom
(
local
,
atom_list
[
i
],
name_list
[
i
]);
}
else
{
...
...
@@ -673,7 +658,7 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
}
else
{
nxagentWriteAtom
(
local
,
remote
,
string
,
True
);
nxagentWriteAtom
(
local
,
remote
,
string
);
return
remote
;
}
...
...
@@ -732,7 +717,7 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local)
return
None
;
}
nxagentWriteAtom
(
local
,
remote
,
string
,
True
);
nxagentWriteAtom
(
local
,
remote
,
string
);
#ifdef TEST
fprintf
(
stderr
,
"%s: local [%d (%s)] -> remote [%d]
\n
"
,
__func__
,
local
,
string
,
remote
);
...
...
@@ -809,7 +794,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote)
local
=
None
;
}
nxagentWriteAtom
(
local
,
remote
,
string
,
True
);
nxagentWriteAtom
(
local
,
remote
,
string
);
#ifdef TEST
fprintf
(
stderr
,
"%s: remote [%d (%s)] -> local [%d]
\n
"
,
__func__
,
remote
,
string
,
local
);
...
...
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