ConnectivityFoundry / AwaLWM2M

Awa LWM2M is an implementation of the OMA Lightweight M2M protocol in C.
BSD 3-Clause "New" or "Revised" License
102 stars 66 forks source link

Failed transactions cause a memory leak #341

Open mtusnio opened 7 years ago

mtusnio commented 7 years ago

Any failed COAP transactions that get sent with Erbium are added to a list of transactions, however they are never removed. From my experience this is because coap_clear_transaction is never called here: https://github.com/FlowM2M/AwaLWM2M/blob/master/core/src/erbium/er-coap-transactions.c#L98 After a while the malloc in coap_new_transaction start returning NULL due to lack of memory.

However, adding coap_clear_transaction there causes any successful requests to fail since they also go into that branch of the if, so it doesn't seem like it's just an easy fix of adding that in.

boyvinall commented 7 years ago

The transactions should be cleared after MAX_TRANSMIT_SPAN, see http://www.rfcreader.com/#rfc7252_line1260