Skip to content

Commit

Permalink
change 'buf' to use stack instead of heap because when the thread is …
Browse files Browse the repository at this point in the history
…terminated, memory could be leaked.
  • Loading branch information
aim2nasa committed Jan 6, 2021
1 parent ffb297f commit 05885c4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ControlCh.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void ControlChThread(uint32_t Value)
{
REG_Resp_t *resp_pt;
uint32_t rt_len,recv,intEvt,regRead,manFrame;
uint8_t *buf = (uint8_t *)CyU3PDmaBufferAlloc (512);
uint8_t buf[512];
CyU3PReturnStatus_t Status;

recv = intEvt = regRead = manFrame = 0;
Expand Down Expand Up @@ -74,7 +74,6 @@ void ControlChThread(uint32_t Value)
CyU3PThreadSleep(10);
}
}
CyU3PDmaBufferFree(buf);
}

CyU3PReturnStatus_t ControlChThread_Create(void)
Expand Down

0 comments on commit 05885c4

Please sign in to comment.