[ENet-discuss] Can modifying packet->dataLength cause leaks?

Kazin Lujan xkazinx at gmail.com
Sun Apr 9 20:00:17 PDT 2017


Could modifying packet->dataLength before being sent cause a leak?

I'm setting it to 0 after I create it and increasing the value based on the
data I'm writing into packet->data.

I'm doing this when I don't know what will be the exact size of the data to
be sent.

I assume enet will destroy all the data regardless of the dataLength value
since it uses packet->data = enet_malloc(...) to allocate in
enet_packet_create and enet_free(packet->data) to deallocate in
enet_packet_destroy(...), but I don't know about enet's internal processes.

Example code: https://pastebin.com/QdaHjqft
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20170410/563f319b/attachment.html>


More information about the ENet-discuss mailing list