From 5ad0b4dde3b686d369d222976e947dcd83058757 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 19:44:37 +0100 Subject: 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(+) (limited to 'nx-X11') 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; -- cgit v1.2.3