[X2Go-Commits] [nx-libs] 333/429: Clipboard.c: fix memleaks in DEBUG mode

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:59 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit d32b4f5b1a55e0bbca79701d2b89bede331fed75
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Sat Oct 3 01:57:58 2020 +0200

    Clipboard.c: fix memleaks in DEBUG mode
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 202eb1baa..74ed61d7f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -2136,10 +2136,16 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
      * by a real time. The reply also contains time "0" which is
      * unexpected (for me) */
     #ifdef DEBUG
+    char *t = XGetAtomName(nxagentDisplay, remTarget);
+    char *p = XGetAtomName(nxagentDisplay, remProperty);
+    char *s = XGetAtomName(nxagentDisplay, remSelection);
     fprintf(stderr, "%s: Sending XConvertSelection to real X server: requestor [0x%x] target [%ld][%s] property [%ld][%s] selection [%ld][%s] time [0][CurrentTime]\n", __func__,
-            serverWindow, remTarget, XGetAtomName(nxagentDisplay, remTarget),
-                remProperty, XGetAtomName(nxagentDisplay, remProperty),
-                    remSelection, XGetAtomName(nxagentDisplay, remSelection));
+                serverWindow, remTarget, validateString(t),
+	            remProperty, validateString(p),
+	                remSelection, validateString(s));
+    SAFE_XFree(t);
+    SAFE_XFree(p);
+    SAFE_XFree(s);
     #endif
 
     XConvertSelection(nxagentDisplay, remSelection, remTarget, remProperty, serverWindow, CurrentTime);
@@ -2193,8 +2199,10 @@ XlibAtom translateLocalToRemoteSelection(Atom local)
   }
 
   #ifdef DEBUG
+  char *r = XGetAtomName(nxagentDisplay, remote);
   fprintf(stderr, "%s: mapping local to remote selection: [%d][%s] -> [%ld] [%s]\n", __func__,
-          local, NameForAtom(local), remote, XGetAtomName(nxagentDisplay, remote));
+              local, NameForAtom(local), remote, validateString(r));
+  SAFE_XFree(r);
   #endif
 
   return remote;
@@ -2235,8 +2243,10 @@ XlibAtom translateLocalToRemoteTarget(Atom local)
   }
 
   #ifdef DEBUG
+  char *r = XGetAtomName(nxagentDisplay, remote);
   fprintf(stderr, "%s: mapping local to remote target: [%d][%s] -> [%ld] [%s]\n", __func__,
-          local, NameForAtom(local), remote, XGetAtomName(nxagentDisplay, remote));
+              local, NameForAtom(local), remote, validateString(r));
+  SAFE_XFree(r);
   #endif
 
   return remote;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list