Skip to content

Commit

Permalink
Valgrind fix - Initialize field with memset
Browse files Browse the repository at this point in the history
Set epoll_event's data field to 0 explicitly with memset
  • Loading branch information
cazulu committed May 16, 2017
1 parent f3b0dbe commit b229554
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions epoll.c.inc
Expand Up @@ -110,7 +110,7 @@ int dill_pollset_in(struct dill_fdclause *fdcl, int id, int fd) {
if(dill_slow(!fdi->cached)) {
struct epoll_event ev;
#ifdef DILL_VALGRIND
ev.data.u64 = 0; //Keep Valgrind happy
memset(&ev.data, 0, sizeof(ev.data)); //Keep Valgrind happy
#endif
ev.data.fd = fd;
ev.events = EPOLLIN;
Expand Down Expand Up @@ -146,7 +146,7 @@ int dill_pollset_out(struct dill_fdclause *fdcl, int id, int fd) {
if(dill_slow(!fdi->cached)) {
struct epoll_event ev;
#ifdef DILL_VALGRIND
ev.data.u64 = 0; //Keep Valgrind happy
memset(&ev.data, 0, sizeof(ev.data)); //Keep Valgrind happy
#endif
ev.data.fd = fd;
ev.events = EPOLLOUT;
Expand Down Expand Up @@ -183,7 +183,7 @@ int dill_pollset_clean(int fd) {
if(fdi->currevs) {
struct epoll_event ev;
#ifdef DILL_VALGRIND
ev.data.u64 = 0; //Keep Valgrind happy
memset(&ev.data, 0, sizeof(ev.data)); //Keep Valgrind happy
#endif
ev.data.fd = fd;
ev.events = 0;
Expand Down

0 comments on commit b229554

Please sign in to comment.