Skip to content

Commit f72dbcf

Browse files
author
Elad Alon
committed
Prevent null pointer dereferencing in WebRtcRemoteEventLogManager
|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}
1 parent d1effdf commit f72dbcf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,17 @@ WebRtcRemoteEventLogManager::~WebRtcRemoteEventLogManager() {
162162
// while destruction took place, thereby avoiding endless attempts to upload
163163
// the same file.
164164

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

170178
void WebRtcRemoteEventLogManager::SetNetworkConnectionTracker(

0 commit comments

Comments
 (0)