Fix a race condition in the HCI module start_up()
* Fix a race condition when using the static startup_future
inside hci_layer.c
The future_new() allocation happens inside function start_up()
and the allocated "startup_future" value is returned, so the caller can
call future_await(future).
However, if firmware_config_callback() is called on another thread
BEFORE the "return startup_future;" statement is reached, then
"startup_future" is reset to NULL. As a result, the caller
will call future_await(NULL), and we have memory leak: startup_future
is never freed.
* Fix other similar potential race conditions inside stack_manager.c
where the static "hack_future" variable could be reassigned between
the future_new() and future_await() calls.
Bug:
25766403
Change-Id: I0ef1165efba7412c190dfa2a7660189b28fa78a6