zero out host memory on creation

This commit is contained in:
eihrul 2011-12-08 14:20:54 +00:00
parent d4768414eb
commit e96c668702

1
host.c
View file

@ -38,6 +38,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
host = (ENetHost *) enet_malloc (sizeof (ENetHost)); host = (ENetHost *) enet_malloc (sizeof (ENetHost));
if (host == NULL) if (host == NULL)
return NULL; return NULL;
memset (host, 0, sizeof (ENetHost));
host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer)); host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer));
if (host -> peers == NULL) if (host -> peers == NULL)