diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-08-03 16:27:41 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-01-15 19:50:35 +0100 |
commit | 36d7e152f1bb977517d0c6f764781d287cf01c26 (patch) | |
tree | f6b335df1675381f892d37bce16cb2b84bb74f33 /nx-X11/programs/Xserver/hw | |
parent | e991dbae988766707e9506ec08d5682416f6eb4a (diff) | |
download | nx-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."
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 8 |
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; + } } /* |