Skip to content

Commit

Permalink
- fixed potential memory leak when GooseReceiver is immediately stopp…
Browse files Browse the repository at this point in the history
…ed after start (I6PLLCV-71)
  • Loading branch information
mzillgith committed Mar 4, 2024
1 parent cdd0684 commit 249df01
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/goose/goose_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,9 +1014,12 @@ gooseReceiverLoop(void *threadParameter)
EthernetHandleSet handleSet = EthernetHandleSet_new();
EthernetHandleSet_addSocket(handleSet, self->ethSocket);

if (self->running) {
bool running = true;

while (self->running) {
if (running)
{
while (running)
{
switch (EthernetHandleSet_waitReady(handleSet, 100))
{
case -1:
Expand All @@ -1030,6 +1033,8 @@ gooseReceiverLoop(void *threadParameter)
}
if (self->stop)
break;

running = self->running;
}

GooseReceiver_stopThreadless(self);
Expand All @@ -1046,7 +1051,8 @@ void
GooseReceiver_start(GooseReceiver self)
{
#if (CONFIG_MMS_THREADLESS_STACK == 0)
if (GooseReceiver_startThreadless(self)) {
if (GooseReceiver_startThreadless(self))
{
self->thread = Thread_create((ThreadExecutionFunction) gooseReceiverLoop, (void*) self, false);

if (self->thread != NULL) {
Expand Down

0 comments on commit 249df01

Please sign in to comment.