propagate malloc failure

This commit is contained in:
eihrul
2010-05-05 23:37:06 +00:00
parent 2be268a77b
commit 41ccbd2f3f
4 changed files with 42 additions and 16 deletions
+2
View File
@@ -20,6 +20,8 @@ ENetPacket *
enet_packet_create (const void * data, size_t dataLength, enet_uint32 flags)
{
ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket));
if (packet == NULL)
return NULL;
if (flags & ENET_PACKET_FLAG_NO_ALLOCATE)
packet -> data = (enet_uint8 *) data;