aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2021-01-04 18:04:29 +0100
committerUlrich Sibiller <uli42@gmx.de>2021-01-15 19:50:36 +0100
commit8bb77997f8e7828846d68a02e8e1f00571f3a4f5 (patch)
treea75dcc0b81232f88d69f387683bde9dbf2420310 /nx-X11/programs/Xserver/hw
parent948bbe50a96c5563a2783f2d9c86a83ded707143 (diff)
downloadnx-libs-8bb77997f8e7828846d68a02e8e1f00571f3a4f5.tar.gz
nx-libs-8bb77997f8e7828846d68a02e8e1f00571f3a4f5.tar.bz2
nx-libs-8bb77997f8e7828846d68a02e8e1f00571f3a4f5.zip
Reconnect.c: fix possible realloc() memory loss
"V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'nxagentReconnectErrorMessage' is lost. Consider assigning realloc() to a temporary pointer."
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index d0f83e7bd..e6d3ce6ec 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -788,12 +788,16 @@ void nxagentSetReconnectError(int id, char *format, ...)
size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE);
}
- nxagentReconnectErrorMessage = realloc(nxagentReconnectErrorMessage, size);
+ char *tmp = realloc(nxagentReconnectErrorMessage, size);
- if (nxagentReconnectErrorMessage == NULL)
+ if (tmp == NULL)
{
FatalError("realloc failed");
}
+ else
+ {
+ nxagentReconnectErrorMessage = tmp;
+ }
}
return;