Fix crash in  ChannelPacketData::Free function
Fix a crash if a call to serialize_xxx macro return false before the allocation of block.message or block.fragmentData.
The release of any of these uninitialized pointer will cause the crash in ChannelPacketData::Free function.
@@ -1353,6 +1353,12 @@ namespace yojimbo
{
const int maxMessageType = messageFactory.GetNumTypes() - 1;
+ if (Stream::IsReading)
+ {
+ block.message = NULL;
+ block.fragmentData = NULL;
+ }
+
serialize_bits( stream, block.messageId, 16 );
if ( channelConfig.GetMaxFragmentsPerBlock() > 1 )
@@ -1430,11 +1436,6 @@ namespace yojimbo
return false;
}
}
- else
- {
- if ( Stream::IsReading )
- block.message = NULL;
- }
return true;
}
