summaryrefslogtreecommitdiffstats
path: root/low-can-binding/utils
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-12-07 12:41:03 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-07 12:41:03 +0100
commit8b8afeed2c93791b37b2451e00b73174e2d296c5 (patch)
tree257ccfa75fecea33a655549833c955607ba4ad2d /low-can-binding/utils
parent9bc0d4c2e996276d0a51bf1d695fb44192f872eb (diff)
Initialize struct to avoid unexpected behavior
Change-Id: I8c160b427f0844e9bc6c7e65fb48cd122160bc65 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/utils')
-rw-r--r--low-can-binding/utils/socketcan.cpp6
1 files changed, 4 insertions, 2 deletions
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
+}