Skip to content

contiki: Clear events pointer once consummed #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/uic_contiki/core/sys/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ static void do_event(void) CC_REENTRANT_ARG

data = events[fevent].data;
receiver = events[fevent].p;
int fevent_copy = fevent; /* To be cleared once processed */

/* Since we have seen the new event, we move pointer upwards
and decrese the number of events. */
Expand Down Expand Up @@ -342,6 +343,9 @@ static void do_event(void) CC_REENTRANT_ARG
/* Make sure that the process actually is running. */
call_process(receiver, ev, data);
}
/* Clear pointer (to potentially unreachable/freed data) */
events[fevent_copy].data = NULL;
events[fevent_copy].p = NULL;
}
}
/*---------------------------------------------------------------------------*/
Expand Down