summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcollin <collin@livio.io>2020-05-20 12:49:38 -0400
committercollin <collin@livio.io>2020-05-20 12:49:38 -0400
commit6ab3ab44b615111cef1b8081ed623f97f12d68ed (patch)
treef1d0557a6538684695a5a319548c32f6497874cf
parentd97eba89a95d9ece139372dd41a918f11a85f99f (diff)
downloadsdl_core-fix/issue_2262.tar.gz
fix memory error in TcpDevice::IsSameAsfix/issue_2262
-rw-r--r--src/components/transport_manager/src/tcp/tcp_device.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc
index 16abdfc22d..d9bc8aec78 100644
--- a/src/components/transport_manager/src/tcp/tcp_device.cc
+++ b/src/components/transport_manager/src/tcp/tcp_device.cc
@@ -66,9 +66,9 @@ TcpDevice::TcpDevice(const in_addr_t& in_addr,
bool TcpDevice::IsSameAs(const Device* other) const {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Device: " << other);
- const TcpDevice* other_tcp_device = static_cast<const TcpDevice*>(other);
+ const TcpDevice* other_tcp_device = dynamic_cast<const TcpDevice*>(other);
- if (other_tcp_device->in_addr_ == in_addr_) {
+ if (other_tcp_device && other_tcp_device->in_addr_ == in_addr_) {
LOG4CXX_TRACE(
logger_,
"exit with TRUE. Condition: other_tcp_device->in_addr_ == in_addr_");