Skip to content

Commit

Permalink
Fix memory leackage
Browse files Browse the repository at this point in the history
  • Loading branch information
nurikk committed Aug 10, 2020
1 parent 1cb1ba1 commit 7f16878
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Source/zcl_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,27 @@ void zclApp_Init(byte task_id) {

uint16 zclApp_event_loop(uint8 task_id, uint16 events) {
LREP("events 0x%x \r\n", events);
if (events & SYS_EVENT_MSG) {
afIncomingMSGPacket_t *MSGpkt;
while ((MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive(zclApp_TaskID))) {
LREP("MSGpkt->hdr.event 0x%X clusterId=0x%X\r\n", MSGpkt->hdr.event, MSGpkt->clusterId);
switch (MSGpkt->hdr.event) {
case ZCL_INCOMING_MSG:
if (((zclIncomingMsg_t *)MSGpkt)->attrCmd) {
osal_mem_free(((zclIncomingMsg_t *)MSGpkt)->attrCmd);
}
break;

default:
break;
}

// Release the memory
osal_msg_deallocate((uint8 *)MSGpkt);
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
if (events & APP_REPORT_EVT) {
LREPMaster("APP_REPORT_EVT\r\n");
zclApp_Report();
Expand Down

0 comments on commit 7f16878

Please sign in to comment.