Commit 891f24c6 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Display.c: fix common realloc mistake

As reported by static analyzer: (error) Common realloc mistake: 'nxagentVisuals' nulled but not freed upon failure
parent 9b56675d
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment