aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-08-03 16:27:41 +0200
committerUlrich Sibiller <uli42@gmx.de>2021-01-15 19:50:35 +0100
commit36d7e152f1bb977517d0c6f764781d287cf01c26 (patch)
treef6b335df1675381f892d37bce16cb2b84bb74f33
parente991dbae988766707e9506ec08d5682416f6eb4a (diff)
downloadnx-libs-36d7e152f1bb977517d0c6f764781d287cf01c26.tar.gz
nx-libs-36d7e152f1bb977517d0c6f764781d287cf01c26.tar.bz2
nx-libs-36d7e152f1bb977517d0c6f764781d287cf01c26.zip
Atoms.c: silence PVS Studio warning
"V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'privAtomMap' is lost. Consider assigning realloc() to a temporary pointer."
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
index 2daad061e..61953e2a6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
@@ -385,12 +385,16 @@ static void nxagentExpandCache(void)
{
privAtomMapSize += NXAGENT_ATOM_MAP_SIZE_INCREMENT;
- privAtomMap = realloc(privAtomMap, privAtomMapSize * sizeof(AtomMap));
+ AtomMap * newmap = realloc(privAtomMap, privAtomMapSize * sizeof(AtomMap));
- if (privAtomMap == NULL)
+ if (newmap == NULL)
{
FatalError("nxagentExpandCache: realloc failed\n");
}
+ else
+ {
+ privAtomMap = newmap;
+ }
}
/*