mynewt-nimble icon indicating copy to clipboard operation
mynewt-nimble copied to clipboard

There is a bug in 'mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c' npl_freertos_callout_init function!!

Open novumdun opened this issue 4 years ago • 0 comments

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:

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);
}

novumdun avatar Aug 31 '21 00:08 novumdun