Commit 8bb77997 authored by Ulrich Sibiller's avatar Ulrich Sibiller

Reconnect.c: fix possible realloc() memory loss

"V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'nxagentReconnectErrorMessage' is lost. Consider assigning realloc() to a temporary pointer."
parent 948bbe50
......@@ -788,12 +788,16 @@ void nxagentSetReconnectError(int id, char *format, ...)
size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE);
}
nxagentReconnectErrorMessage = realloc(nxagentReconnectErrorMessage, size);
char *tmp = realloc(nxagentReconnectErrorMessage, size);
if (nxagentReconnectErrorMessage == NULL)
if (tmp == NULL)
{
FatalError("realloc failed");
}
else
{
nxagentReconnectErrorMessage = tmp;
}
}
return;
......
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