This patch fixes some errors relating to not initializing memory
properly.  I found these by using valgrind.

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

diff --git a/fea/data_plane/io/io_ip_socket.cc 
b/fea/data_plane/io/io_ip_socket.cc
index 1b4761c..bc78a56 100644
--- a/fea/data_plane/io/io_ip_socket.cc
+++ b/fea/data_plane/io/io_ip_socket.cc
@@ -266,6 +266,8 @@ IoIpSocket::IoIpSocket(FeaDataPlaneManager& 
fea_data_plane_manager,
     _rcvcmsgbuf = new uint8_t[CMSG_BUF_SIZE];
     _sndcmsgbuf = new uint8_t[CMSG_BUF_SIZE];
 
+    memset(_sndcmsgbuf, 0, CMSG_BUF_SIZE);
+
     // Scatter/gatter array initialization
     _rcviov[0].iov_base                = (caddr_t)_rcvbuf;
     _rcviov[0].iov_len         = IO_BUF_SIZE;
@@ -274,6 +276,10 @@ IoIpSocket::IoIpSocket(FeaDataPlaneManager& 
fea_data_plane_manager,
 
     // recvmsg() and sendmsg() related initialization
 #ifndef HOST_OS_WINDOWS
+
+    memset(&_rcvmh, 0, sizeof(_rcvmh));
+    memset(&_sndmh, 0, sizeof(_sndmh));
+
     switch (family) {
     case AF_INET:
        _rcvmh.msg_name         = (caddr_t)&_from4;
diff --git a/fea/ifconfig_transaction.hh b/fea/ifconfig_transaction.hh
index 309450d..dc6cc11 100644
--- a/fea/ifconfig_transaction.hh
+++ b/fea/ifconfig_transaction.hh
@@ -38,7 +38,9 @@ public:
      */
     IfConfigTransactionManager(EventLoop& eventloop)
        : TransactionManager(eventloop, TIMEOUT_MS, MAX_PENDING)
-    {}
+       {
+           _tid_exec = 0xFFFFFFFF;
+       }
 
     /**
      * Get the string with the first error during commit.
diff --git a/libxorp/transaction.hh b/libxorp/transaction.hh
index 6766336..bc34764 100644
--- a/libxorp/transaction.hh
+++ b/libxorp/transaction.hh
@@ -92,7 +92,7 @@ public:
     TransactionManager(EventLoop& e,
                       uint32_t timeout_ms = 0,
                       uint32_t max_pending = 10) : 
-       _e(e), _timeout_ms(timeout_ms), _max_pending(max_pending) 
+           _e(e), _timeout_ms(timeout_ms), _max_pending(max_pending), 
_next_tid(0)
     {
     }
 
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to