Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dangling pointer in HttpsOnlyMode[Allow|Enforce]list
StatefulSSLHostStateDelegate owns a HttpsOnlyModeAllowlist and a HttpsOnlyModeEnforcelist object, passing them a pointer to the Clock that it owns. However, when setting a Clock object in testing via StatefulSSLHostStateDelegate::SetClockForTesting(), the pointers held by the HttpsOnlyModeAllowlist and HttpsOnlyModeEnforcelist would very briefly be dangling between the Delegate taking ownership of the new Clock object (causing the old Clock object to be destroyed) and a new raw pointer to the new Clock object being passed into the Allowlist and Enforcelist objects. This fixes that brief dangling (which caused the DanglingPtr detector to trigger) by resetting the Clock pointer in the Allowlist/Enforcelist to nullptr before setting the new Clock object. Bug: 1442617 Change-Id: I76a5138dcc4c384f9bfc3045b79e2773fad13080 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4727236 Auto-Submit: Chris Thompson <[email protected]> Reviewed-by: Mustafa Emre Acer <[email protected]> Commit-Queue: Mustafa Emre Acer <[email protected]> Cr-Commit-Position: refs/heads/main@{#1176564}
- Loading branch information