Bluetooth: host: Use log_strdup() for stack strings

Prevent temporary strings from being printed incorrectly if they go out
of scope before being processed by logger.

Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
This commit is contained in:
Filip Kubicz 2019-02-21 11:44:23 +01:00 committed by Anas Nashif
commit e44011b6e3
2 changed files with 2 additions and 2 deletions

View file

@ -2884,7 +2884,7 @@ static int bt_gatt_store_cf(struct bt_conn *conn)
return err;
}
BT_DBG("Stored CF for %s (%s)", bt_addr_le_str(&conn->le.dst), key);
BT_DBG("Stored CF for %s (%s)", bt_addr_le_str(&conn->le.dst), log_strdup(key));
#endif /* CONFIG_BT_GATT_CACHING */
return 0;

View file

@ -81,7 +81,7 @@ int bt_settings_decode_key(char *key, bt_addr_le_t *addr)
}
}
BT_DBG("Decoded %s as %s", key, bt_addr_le_str(addr));
BT_DBG("Decoded %s as %s", log_strdup(key), bt_addr_le_str(addr));
return 0;
}