When I use "valgrind --tool=memcheck" on a libevent-based program, it gives the following complaint:
==15442== Conditional jump or move depends on uninitialised value(s) ==15442== at 0x4C0F2D3: event_add (event.c:632) ==15442== by 0x405EE4: main_loop (net.c:356) ==15442== by 0x411853: main (tincd.c:329) Here's the relevant portion of event.c: 632 if ((ev->ev_flags & EVLIST_ACTIVE) && 633 (ev->ev_res & EV_TIMEOUT)) { I've looked through the libevent code and verified that ev_res is always initialized when (ev_flags & EVLIST_ACTIVE) is true, so there's no real bug here. However, it's useful to suppress noise in valgrind output, and there's no real cost to initializing ev_res at event_set time. Thus the attached patch. Best regards, Scott -- Scott Lamb <http://www.slamb.org/>
Avoid valgrind warning ==15442== Conditional jump or move depends on uninitialised value(s) ==15442== at 0x4C0F2D3: event_add (event.c:632) ==15442== by 0x405EE4: main_loop (net.c:356) ==15442== by 0x411853: main (tincd.c:329) Index: event.c =================================================================== --- event.c (revision 369) +++ event.c (working copy) @@ -530,6 +530,7 @@ ev->ev_arg = arg; ev->ev_fd = fd; ev->ev_events = events; + ev->ev_res = 0; ev->ev_flags = EVLIST_INIT; ev->ev_ncalls = 0; ev->ev_pncalls = NULL;
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users