Fixed allocation size warning.

This commit is contained in:
Armin Novak 2014-11-16 23:41:28 +01:00
parent ad1a029876
commit 28220d5b9f
1 changed files with 20 additions and 1 deletions

View File

@ -614,8 +614,27 @@ int WLog_AddChild(wLog* parent, wLog* child)
{
if (parent->ChildrenCount >= parent->ChildrenSize)
{
wLog **tmp;
parent->ChildrenSize *= 2;
parent->Children = (wLog**) realloc(parent->Children, sizeof(wLog*) * parent->ChildrenSize);
if (!parent->ChildrenSize)
{
if (parent->Children)
free (parent->Children);
parent->Children = NULL;
}
else
{
tmp = (wLog**) realloc(parent->Children, sizeof(wLog*) * parent->ChildrenSize);
if (!tmp)
{
if (parent->Children)
free (parent->Children);
parent->Children = NULL;
return -1;
}
parent->Children = tmp
}
}
parent->Children[parent->ChildrenCount++] = child;