aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-01-07 21:27:04 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-05-07 12:55:04 +0200
commit66eea14c241cf0aebeccfb0d1f0d98e7dcbf4b73 (patch)
treed680d891956ffac3a79a9f465145f5e940c62c94
parent18439f55a04501b93fe8617850b5c1510b0d4885 (diff)
downloadnx-libs-66eea14c241cf0aebeccfb0d1f0d98e7dcbf4b73.tar.gz
nx-libs-66eea14c241cf0aebeccfb0d1f0d98e7dcbf4b73.tar.bz2
nx-libs-66eea14c241cf0aebeccfb0d1f0d98e7dcbf4b73.zip
nxagent: Free atom map on termination
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.c15
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c2
3 files changed, 17 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
index eecead6e1..2e144bb0c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
@@ -364,7 +364,7 @@ int nxagentQueryAtoms(ScreenPtr pScreen)
typedef struct {
Atom local;
XlibAtom remote;
- const char *string;
+ char *string;
int length;
} AtomMap;
@@ -397,7 +397,7 @@ static void nxagentExpandCache(void)
static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string)
{
- const char *s = strdup(string);
+ char *s = strdup(string);
#ifdef WARNING
if (s == NULL)
@@ -436,6 +436,17 @@ void nxagentResetAtomMap(void)
nxagentPrintAtomMapInfo("nxagentResetAtomMap: Exiting");
}
+void nxagentFreeAtomMap(void)
+{
+ for (unsigned int i = 0; i < privLastAtom; i++)
+ {
+ SAFE_free(privAtomMap[i].string);
+ }
+
+ SAFE_free(privAtomMap);
+ privLastAtom = privAtomMapSize = 0;
+}
+
/*
* Init map.
* Initializing the atomNameList all in one.
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
index 8dff0d5a7..a39c53c07 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
@@ -51,6 +51,8 @@ int nxagentQueryAtoms(ScreenPtr pScreen);
void nxagentResetAtomMap(void);
+void nxagentFreeAtomMap(void);
+
void nxagentWMDetect(void);
#ifdef XlibAtom
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
index ad9ce771f..ede0ffdcc 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
@@ -580,6 +580,8 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
NXShadowDestroy();
}
saveAgentState("TERMINATED");
+
+ nxagentFreeAtomMap();
#endif /* NXAGENT_SERVER */
KillAllClients();