[ovs-dev] [PATCH] timeval: Hide "memory leak" from Valgrind.
Ben Pfaff
blp at nicira.com
Fri Jun 25 20:29:00 UTC 2010
Thanks, I pushed it out.
On Thu, Jun 24, 2010 at 01:10:45PM -0700, Justin Pettit wrote:
> Weird. Go for it.
>
> --Justin
>
>
> On Jun 24, 2010, at 11:35 AM, Ben Pfaff wrote:
>
> > 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.
> > ---
> > lib/timeval.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/lib/timeval.c b/lib/timeval.c
> > index f3e6583..c69799d 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();
> > --
> > 1.7.1
> >
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>
More information about the dev
mailing list