CLI mode uninitialization is causing hardfault

I have a setup what startups up a device in CLI mode (UART + RTT) when certain test condition set at bootup. 

However, I implemented a command to "uninitialize" CLI mode for UART and RTT when sent a certain command - say "set_cli_inactive" - a custom CLI command. 

When this command is called, the following lines are executed:

/// Process any pending CLI
nrf_cli_process(&m_cli_uart);
/// Stop CLI
ret = nrf_cli_stop(&m_cli_uart);
APP_ERROR_CHECK(ret);
/// Uninit CLI
ret = nrf_cli_uninit(&m_cli_uart);
APP_ERROR_CHECK(ret);

However - deep inside the function call 'nrf_cli_uninit(...)' , going inside 'nrf_cli_instance_uninit(p_cli);' and then I see that the last line exectud before hardfault is 'nrf_log_backend_disable(p_cli->p_log_backend);'

Resulting in:

Hard Fault at address: 0x00000000

No order of operation changes help, I don't see what is missing. Is there a bug in the SDK code?

Using SDK 15.3

Related