From 41ccbd2f3f5fca4e427aa99c3b06a573eabb7853 Mon Sep 17 00:00:00 2001 From: eihrul Date: Wed, 5 May 2010 23:37:06 +0000 Subject: propagate malloc failure --- packet.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packet.c') diff --git a/packet.c b/packet.c index 7f18e49..2fc9a10 100644 --- a/packet.c +++ b/packet.c @@ -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; -- cgit v1.2.3