diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 6df73a3c5..5a432275e 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -1887,7 +1887,7 @@ ble_gap_rx_adv_report_sanity_check(const uint8_t *adv_data, uint8_t adv_data_len STATS_INC(ble_gap_stats, rx_adv_report); -#if !MYNEWT_VAL(BLE_HOST_ALLOW_CONNECT_WITH_SCAN) +#if MYNEWT_VAL(BLE_HOST_ALLOW_CONNECT_WITH_SCAN) /* In case to allow scan with connect, return directly */ return 0; #endif diff --git a/porting/npl/freertos/src/npl_os_freertos.c b/porting/npl/freertos/src/npl_os_freertos.c index e1dcbc0d6..0a434e147 100644 --- a/porting/npl/freertos/src/npl_os_freertos.c +++ b/porting/npl/freertos/src/npl_os_freertos.c @@ -1212,16 +1212,6 @@ int npl_freertos_mempool_init(void) } _error: -#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED - if(ble_freertos_ev_buf) { - free(ble_freertos_ev_buf); - ble_freertos_ev_buf = NULL; - } -#else - BLE_LL_ASSERT(rc == 0); - return rc; -#endif - #if CONFIG_BT_CONTROLLER_ENABLED if(ble_freertos_evq_buf) { free(ble_freertos_evq_buf); @@ -1239,12 +1229,18 @@ _error: free(ble_freertos_mutex_buf); ble_freertos_mutex_buf = NULL; } +#endif + +#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED + if(ble_freertos_ev_buf) { + free(ble_freertos_ev_buf); + ble_freertos_ev_buf = NULL; + } return -1; -#else +#endif BLE_LL_ASSERT(rc == 0); return rc; -#endif } void npl_freertos_mempool_deinit(void)