Close socket by default when destroying object
[apps/agl-service-can-low-level.git] / CAN-binder / low-can-binding / utils / socketcan.cpp
index 3aa34d2..71588a6 100644 (file)
@@ -45,7 +45,10 @@ namespace utils
        }
 
        socketcan_t::~socketcan_t()
-       {}
+       {
+               close();
+               socket_ = INVALID_SOCKET;
+       }
 
        const struct sockaddr_can& socketcan_t::get_tx_address() const
        {