Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: fix crash with potential race (#730)
Fixes an [issue](envoyproxy/envoy-mobile#729) where the library could potentially race and crash when calling `flushStats` when `server_` has not yet been assigned. @junr03 astutely pointed out that this could be caused by the fact that `server_` is not assigned to anything, so the `if (server_)` check does not perform as expected. To fix this, we should assign it to `nullptr` immediately. I was able to simulate the race by calling `flushStats()` at the top of `Engine::run()` (before `server_` is assigned). With this patch, the crash disappears. Resolves envoyproxy/envoy-mobile#729. Signed-off-by: Michael Rebello <me@michaelrebello.com> Signed-off-by: JP Simard <jp@jpsim.com>
- Loading branch information