From: Ben Pfaff Date: Thu, 24 Jun 2010 18:35:27 +0000 (-0700) Subject: timeval: Hide "memory leak" from Valgrind. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cfffdd86bbb66408702eab2d9dbc8d1cfe51347;p=openvswitch timeval: Hide "memory leak" from Valgrind. In glibc, "timer_t" is a "void *" that appears to point into malloc()'d memory. By throwing it away entirely, we leak it, which makes valgrind complain. We really don't ever care to use the timer object again, but we can't destroy it without stopping the periodic timer. So make it static to avoid a warning from Valgrind. --- diff --git a/lib/timeval.c b/lib/timeval.c index f3e65837..c69799d0 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -141,7 +141,7 @@ time_enable_restart(void) static void set_up_timer(void) { - timer_t timer_id; + static timer_t timer_id; /* "static" to avoid apparent memory leak. */ struct itimerspec itimer; set_up_monotonic();