From: Romain Forlot Date: Thu, 7 Dec 2017 11:41:03 +0000 (+0100) Subject: Initialize struct to avoid unexpected behavior X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=8b8afeed2c93791b37b2451e00b73174e2d296c5;p=apps%2Flow-level-can-service.git Initialize struct to avoid unexpected behavior Change-Id: I8c160b427f0844e9bc6c7e65fb48cd122160bc65 Signed-off-by: Romain Forlot --- diff --git a/low-can-binding/utils/socketcan.cpp b/low-can-binding/utils/socketcan.cpp index 71588a6..b943d1d 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 +}