Skip to content

Commit

Permalink
Prevent null pointer dereferencing in WebRtcRemoteEventLogManager
Browse files Browse the repository at this point in the history
|network_connection_tracker_| might never be set (if no profile
is loaded). In that case, it should not be dereferenced.

Bug: 866865
Change-Id: I490be08795f41908d7ac49fdcd5d8588fbea83b7
Reviewed-on: https://chromium-review.googlesource.com/1148335
Commit-Queue: Elad Alon <[email protected]>
Reviewed-by: Max Morin <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#577528}(cherry picked from commit ac6c083)
Reviewed-on: https://chromium-review.googlesource.com/1149841
Reviewed-by: Elad Alon <[email protected]>
Cr-Commit-Position: refs/branch-heads/3497@{#74}
Cr-Branched-From: 271eaf5-refs/heads/master@{#576753}
  • Loading branch information
Elad Alon committed Jul 25, 2018
1 parent d1effdf commit f72dbcf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,17 @@ WebRtcRemoteEventLogManager::~WebRtcRemoteEventLogManager() {
// while destruction took place, thereby avoiding endless attempts to upload
// the same file.

// |network_connection_tracker_| might already have posted a task back to us,
// but it will not run, because |task_runner_| has already been stopped.
network_connection_tracker_->RemoveNetworkConnectionObserver(this);
if (network_connection_tracker_) {
// * |network_connection_tracker_| might already have posted a task back
// to us, but it will not run, because |task_runner_| has already been
// stopped.
// * RemoveNetworkConnectionObserver() should generally be called on the
// same thread as AddNetworkConnectionObserver(), but in this case it's
// okay to remove on a separate thread, because this only happens during
// Chrome shutdown, when no others tasks are running; there can be no
// concurrently executing notification from the tracker.
network_connection_tracker_->RemoveNetworkConnectionObserver(this);
}
}

void WebRtcRemoteEventLogManager::SetNetworkConnectionTracker(
Expand Down

0 comments on commit f72dbcf

Please sign in to comment.