Commit 67c7513b authored by Ulrich Sibiller's avatar Ulrich Sibiller

Display.c: prevent PVS Studio realloc warning

"V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'nxagentDefaultColormaps' is lost. Consider assigning realloc() to a temporary pointer."
parent db134de3
......@@ -2577,12 +2577,18 @@ Bool nxagentReconnectDisplay(void *p0)
nxagentNumDefaultColormaps = nxagentNumVisuals;
nxagentDefaultColormaps = (Colormap *) realloc(nxagentDefaultColormaps,
nxagentNumDefaultColormaps * sizeof(Colormap));
if (nxagentDefaultColormaps == NULL)
{
FatalError("Can't allocate memory for the default colormaps\n");
Colormap * tmp = (Colormap *) realloc(nxagentDefaultColormaps,
nxagentNumDefaultColormaps * sizeof(Colormap));
if (tmp == NULL)
{
SAFE_free(nxagentDefaultColormaps);
FatalError("Can't allocate memory for the default colormaps\n");
}
else
{
nxagentDefaultColormaps = tmp;
}
}
reconnectDisplayState = ALLOC_DEF_COLORMAP;
......
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