/* Command response callback function for sd_ble_user_mem_reply BLE command. 
Callback for decoding the output parameters and the command response return code. */
static uint32_t user_mem_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_user_mem_reply BLE command. 
Callback for decoding the output parameters and the command response return code. */
static uint32_t user_mem_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{
    uint32_t result_code;
    uint32_t err_code = ble_user_mem_reply_rsp_dec(p_buffer,
                                                         length,
                                                         &result_code);
    APP_ERROR_CHECK(err_code);
    if ((result_code != NRF_SUCCESS) && 
        (m_output_params.ble_user_mem_reply_out_params.context_allocated))
    {
        err_code = app_ble_user_mem_context_destroy(
                       m_output_params.ble_user_mem_reply_out_params.conn_handle);
        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
    }
    return result_code;
}