Browse Source

[2275] valgrind fixes: uninitialized memory

Jelte Jansen 12 years ago
parent
commit
1c4ec91a6f

+ 1 - 1
src/lib/server_common/tests/socket_requestor_test.cc

@@ -410,6 +410,7 @@ private:
             isc_throw(Unexpected,
                       "mkstemp() created a filename too long for sun_path");
         }
+        memset(socket_address.sun_path, 0, sizeof(socket_address.sun_path));
         strncpy(socket_address.sun_path, path_, len);
 #ifdef HAVE_SA_LEN
         socket_address.sun_len = len;
@@ -542,7 +543,6 @@ TEST_F(SocketRequestorTest, testSocketPassing) {
         EXPECT_EQ("foo", socket_id.second);
         EXPECT_EQ(0, close(socket_id.first));
     }
-
     // Create a second socket server, to test that multiple different
     // domains sockets would work as well (even though we don't actually
     // use that feature)

+ 1 - 0
src/lib/util/io/fd_share.cc

@@ -142,6 +142,7 @@ send_fd(const int sock, const int fd) {
     if (msghdr.msg_control == NULL) {
         return (FD_OTHER_ERROR);
     }
+    memset(msghdr.msg_control, 0, msghdr.msg_controllen);
 
     struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msghdr);
     cmsg->cmsg_len = cmsg_len(sizeof(int));