diff --git a/nimble/host/src/ble_hs_periodic_sync.c b/nimble/host/src/ble_hs_periodic_sync.c index bfa52d689..1d3a9cc72 100644 --- a/nimble/host/src/ble_hs_periodic_sync.c +++ b/nimble/host/src/ble_hs_periodic_sync.c @@ -43,7 +43,6 @@ ble_hs_periodic_sync_alloc(void) memset(psync, 0, sizeof(*psync)); } - ble_npl_event_init(&psync->lost_ev, ble_gap_npl_sync_lost, psync); return psync; } @@ -56,7 +55,9 @@ ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync) return; } - ble_npl_event_deinit(&psync->lost_ev); + if((psync->lost_ev).event != NULL) + ble_npl_event_deinit(&psync->lost_ev); + #if MYNEWT_VAL(BLE_HS_DEBUG) memset(psync, 0xff, sizeof *psync); #endif