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

Damijan Skvarc damjan.skvarc at gmail.com
Tue Oct 1 08:23:45 UTC 2019

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.


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