I was experiencing a memory leak during nbns/llmnr host name resolution of my device. I found out that the reply message to the resolve request is used with a parameter not to free the descriptor after sending it . Why should the memory for a dns reply not be freed after sending it?
Thats the function:
vReturnEthernetFrame( pxNetworkBuffer, pdFALSE );
Called in prvReplyDNSMessage(…) of the source file FreeRTOS_DNS.c.
To solve the issue I set pdFALSE to pdTRUE. So my output function will free the buffer descriptor.
Your proposed change will not work properly in projects where BufferAllocation_1.c is used. Explanation:
BufferAllocation_1.c
When a LLMNR or NBNS request must be answered, the current network buffer is re-used to send a reply. Later on, the network buffer is released by the caller.
BufferAllocation_2.c
The reply is longer than the request, and the network buffer is just big enough to hold the request. In order to reply, a new network buffer must be created, which is a bit longer.
This new buffer is called pxNewBuffer, and must be release after use ( in two locations, LLMNR and NBNS ):
I understand, thanks a lot for your proper explantion. I will do the change accordingly to yours. Altough I don’t use BufferAllocation_1.c it is much better to keep it compatible to the other allocation styles, like your way.