From 6660e43c309a7e4e912be5e60805a2bfbaeff7d9 Mon Sep 17 00:00:00 2001 From: Jonas Oreland Date: Fri, 20 Dec 2024 12:59:40 +0100 Subject: [PATCH] Forward fix bug in https://webrtc-review.googlesource.com/c/src/+/372201 This patch fixes a scenario in which the ssl_ object was freed. BUG=webrtc:383141571 Change-Id: I413b028473aff9c3078f9bbab8e1fee718623417 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372340 Commit-Queue: Jonas Oreland Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#43621} --- rtc_base/openssl_stream_adapter.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rtc_base/openssl_stream_adapter.cc b/rtc_base/openssl_stream_adapter.cc index 6951899bba..ae44662a59 100644 --- a/rtc_base/openssl_stream_adapter.cc +++ b/rtc_base/openssl_stream_adapter.cc @@ -930,10 +930,12 @@ int OpenSSLStreamAdapter::ContinueSSL() { } } - struct timeval timeout; - if (DTLSv1_get_timeout(ssl_, &timeout)) { - int delay = timeout.tv_sec * 1000 + timeout.tv_usec / 1000; - SetTimeout(delay); + if (ssl_ != nullptr) { + struct timeval timeout; + if (DTLSv1_get_timeout(ssl_, &timeout)) { + int delay = timeout.tv_sec * 1000 + timeout.tv_usec / 1000; + SetTimeout(delay); + } } return 0;