Initialize struct to avoid unexpected behavior
authorRomain Forlot <romain.forlot@iot.bzh>
Thu, 7 Dec 2017 11:41:03 +0000 (12:41 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 7 Dec 2017 11:41:03 +0000 (12:41 +0100)
Change-Id: I8c160b427f0844e9bc6c7e65fb48cd122160bc65
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
low-can-binding/utils/socketcan.cpp

index 71588a6..b943d1d 100644 (file)
@@ -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
+}