]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: epoll: always initialize all of epoll_event to please valgrind
authorWilly Tarreau <w@1wt.eu>
Wed, 26 Feb 2020 13:32:53 +0000 (14:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 26 Feb 2020 13:36:27 +0000 (14:36 +0100)
valgrind complains that epoll_ctl() uses an epoll_event in which we
have only set the part we use from the data field (i.e. the fd). Tests
show that pre-initializing the struct in the stack doesn't have a
measurable impact so let's do it.

src/ev_epoll.c

index 5122510092e3411d0f2a5a6b8e59d4fc6aef0644..1d204f9255bc2bdb145452e9ec8ba3fe10d6938a 100644 (file)
@@ -61,7 +61,7 @@ static void __fd_clo(int fd)
 static void _update_fd(int fd)
 {
        int en, opcode;
-       struct epoll_event ev;
+       struct epoll_event ev = { };
 
        en = fdtab[fd].state;
 
@@ -120,7 +120,6 @@ static void _update_fd(int fd)
        }
 
        /* construct the epoll events based on new state */
-       ev.events = 0;
        if (en & FD_EV_ACTIVE_R)
                ev.events |= EPOLLIN | EPOLLRDHUP;