There is a bug in 'mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c' npl_freertos_callout_init function!!
- Dominant language
- C
- Stars
- 893
- Forks
- 512
- Avg merge
- 13d 31m
- Merged PRs (30d)
- 7
Description
There seems to be a bug in 'mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c' npl_freertos_callout_init function.
For example, each time a connection ends and a new connection starts, the program will create a new timer. This would cause a memory leak. This function should be changed to look like this:
```c
void
npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb, void *ev_arg)
{
if(0 == co->handle) {
co->handle = xTimerCreate("co", 1, pdFALSE, co, os_callout_timer_cb);
}
co->evq = evq;
ble_npl_event_init(&co->ev, ev_cb, ev_arg);
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in porting/npl/freertos/src/npl_os_freertos.c at npl_freertos_callout_init and inspect how the callout handle is created and reused. Confirm repeated connection setup does not create an additional timer, while event-queue and event initialization still occur; run the relevant FreeRTOS/NPL validation available in the repository.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100