diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-01-25 23:05:14 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 14:57:15 +0200 |
commit | 891f24c6521d8c84ab900810b85f41affba9a42e (patch) | |
tree | 164144b3cea9da22ed6d01f105f92458b79088cc /nx-X11/programs/Xserver | |
parent | 9b56675dd10aee122c2a6a0c2351b8199a4aa3ba (diff) | |
download | nx-libs-891f24c6521d8c84ab900810b85f41affba9a42e.tar.gz nx-libs-891f24c6521d8c84ab900810b85f41affba9a42e.tar.bz2 nx-libs-891f24c6521d8c84ab900810b85f41affba9a42e.zip |
Display.c: fix common realloc mistake
As reported by static analyzer:
(error) Common realloc mistake: 'nxagentVisuals' nulled but not freed upon failure
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Display.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index c8ad891be..bc85d821d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1494,8 +1494,13 @@ void nxagentInitVisuals(void) if (nxagentVisuals != NULL) { - nxagentVisuals = (XVisualInfo *) realloc(nxagentVisuals, - nxagentNumVisuals * sizeof(XVisualInfo)); + XVisualInfo *new = (XVisualInfo *) realloc(nxagentVisuals, + nxagentNumVisuals * sizeof(XVisualInfo)); + /* nxagentVisuals being NULL is covered below */ + if (new) + nxagentVisuals = new; + else + SAFE_free(nxagentVisuals); } SAFE_XFree(viList); |