[ovs-dev] [PATCH 1/1] ovsdb-client: fix memory leak in do_needs_conversion() and do_convert()

Ben Pfaff blp at ovn.org
Tue Oct 1 16:19:18 UTC 2019


You are right.  Thank you.  I applied this to master.

On Tue, Oct 01, 2019 at 10:23:45AM +0200, Damijan Skvarc wrote:
> Hi Ben and thanks for review.
> 
> I double checked and I can confirm the patch is ok.
> Changes which are applied to rpc pointer within do_convert() and
> do_need_conversion() function are local to
> functions and not propagated to outside world. This is because rpc is
> passed to command handler functions as
> pointer and reference to the pointer. Therefore main() could not know rpc
> has been changed inside command
> handler functions.
> 
> regards,Damijan.
> 
> 
> On Mon, Sep 30, 2019 at 10:47 PM Ben Pfaff <blp at ovn.org> wrote:
> 
> > On Mon, Sep 30, 2019 at 10:21:00AM +0200, Damijan Skvarc wrote:
> > > Memory leak itself is not so important, however the problem is that
> > > it is caused by forgetting to close rpc channel which might in
> > > a long term lead to the leak of system resources.
> > >
> > > Memory leak is reported by Valgrin running test suite and is expressed
> > as:
> >
> > Thanks for the fix.
> >
> > I don't understand why this is necessary.  These functions are called
> > from main(), which closes the rpc connection just afterward:
> >
> >     command->handler(rpc, database, argc - optind, argv + optind);
> >
> >     free(database);
> >     jsonrpc_close(rpc);
> >
> > Can you take a closer look?
> >


More information about the dev mailing list