diff --git a/emulator/bthost.c b/emulator/bthost.c
index a123228..104916b 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
if (!bthost)
return NULL;
+ bthost->smp_data = smp_start(bthost);
+ if (!bthost->smp_data) {
+ free(bthost);
+ return NULL;
+ }
+
/* Set defaults */
bthost->io_capability = 0x03;
if (bthost->rfcomm_conn_data)
free(bthost->rfcomm_conn_data);
+ smp_stop(bthost->smp_data);
+
free(bthost);
}
if (!bthost)
return;
- bthost->smp_data = smp_start(bthost);
-
bthost->ncmd = 1;
send_command(bthost, BT_HCI_CMD_RESET, NULL, 0);
void bthost_stop(struct bthost *bthost)
{
- if (bthost->smp_data) {
- smp_stop(bthost->smp_data);
- bthost->smp_data = NULL;
- }
}