From 66eea14c241cf0aebeccfb0d1f0d98e7dcbf4b73 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 21:27:04 +0100 Subject: nxagent: Free atom map on termination --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 15 +++++++++++++-- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 ++ nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 ++ 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(); -- cgit v1.2.3