[X2Go-Commits] [nx-libs] 190/429: Window.c: check for malloc failure

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:26 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 5ad0b4dde3b686d369d222976e947dcd83058757
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon Jan 4 19:44:37 2021 +0100

    Window.c: check for malloc failure
    
    PVS finding: "V522 There might be dereferencing of a potential null pointer 'nxagentConfiguredWindowList'."
---
 nx-X11/programs/Xserver/hw/nxagent/Window.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index a30eac589..367c15841 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -3659,6 +3659,14 @@ void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int o
   StaticResizedWindowStruct *tmp = nxagentStaticResizedWindowList;
 
   nxagentStaticResizedWindowList = malloc(sizeof(StaticResizedWindowStruct));
+  if (!nxagentStaticResizedWindowList)
+  {
+    #ifdef WARNING
+    fprintf(stderr, "WARNING: could not allocate memory for nxagentStaticResizedWindowList\n");
+    #endif
+    nxagentStaticResizedWindowList = tmp;
+    return;
+  }
   nxagentStaticResizedWindowList -> next = tmp;
   nxagentStaticResizedWindowList -> prev = NULL;
 

--
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