From 3fe9374a579ce30f5022d81dd2cba30ed408662d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 21 Dec 2017 13:45:58 +0100 Subject: Code enhancements mem leaks and uninitialized byte Change-Id: I40632b6212118278f5877957a480122e9383e3bc Signed-off-by: Romain Forlot --- low-can-binding/utils/socketcan.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'low-can-binding/utils') diff --git a/low-can-binding/utils/socketcan.cpp b/low-can-binding/utils/socketcan.cpp index 71588a6e..b943d1d7 100644 --- a/low-can-binding/utils/socketcan.cpp +++ b/low-can-binding/utils/socketcan.cpp @@ -29,7 +29,9 @@ namespace utils /// @brief Construct a default, invalid, socket. socketcan_t::socketcan_t() : socket_{INVALID_SOCKET} - {} + { + ::memset(&tx_address_, 0, sizeof(tx_address_)); + } /// @brief Construct a socket by moving an existing one. socketcan_t::socketcan_t(socketcan_t&& s) @@ -94,4 +96,4 @@ namespace utils { return socket_; } -} \ No newline at end of file +} -- cgit 1.2.3-korg