On Fri, May 13, 2016 at 11:30:14PM -0700, William Tu wrote:
> Hi Ryan,
> 
> Thanks for the feedback.
> 
> > --- a/ovn/utilities/ovn-sbctl.c
> > > +++ b/ovn/utilities/ovn-sbctl.c
> > > @@ -973,6 +973,7 @@ do_sbctl(const char *args, struct ctl_command
> > > *commands, size_t n_commands,
> > >      free(commands);
> > >      ovsdb_idl_txn_destroy(txn);
> > >      ovsdb_idl_destroy(idl);
> > > +    free(CONST_CAST(char *, args));
> > >
> > >      exit(EXIT_SUCCESS);
> >
> > Actually I don't understand why valgrind reports "definitely lost" here.
> If the process is about to exit(), and we still have access to pointers
> pointing to un-free memory (ex: args), valgrind should report as "still
> reachable", not "definitely lost".
> 
> 
> > While this will work, my preference in both cases would be to make
> > the call to free from inside the main block, so that the same
> > block allocates the memory and then frees it.
> >
> >
> The main block is an infinite "for (;;)" and program exits only at
> do_nbctl(). I couldn't find a way to call the free inside the main loop. Do
> you have any suggestion?

Just make do_nbctl() return a success indication, then the caller can
exit if it succeeds.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to