[ovs-dev] [PATCH] ovn-controller: Fix memory leak reported by valgrind.
Ben Pfaff
blp at ovn.org
Fri Jun 10 15:45:03 UTC 2016
On Sun, Jun 05, 2016 at 07:37:35AM -0700, William Tu wrote:
> Calling ovsdb_idl_set_remote() might overwrite the 'idl->session'. The patch
> fixes them by freeing 'idl->session' before it is overwritten.
>
> Testcast ovn-controller - ovn-bridge-mappings reports two definitely losts in:
> xmalloc (util.c:112)
> jsonrpc_session_open (jsonrpc.c:784)
> ovsdb_idl_create (ovsdb-idl.c:246)
> main (ovn-controller.c:384)
> and,
> xmalloc (util.c:112)
> jsonrpc_session_open (jsonrpc.c:784)
> ovsdb_idl_set_remote (ovsdb-idl.c:289)
> main (ovn-controller.c:409)
>
> Signed-off-by: William Tu <u9012063 at gmail.com>
> ---
> lib/ovsdb-idl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index 2b372cb..15421ac 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -286,6 +286,9 @@ ovsdb_idl_set_remote(struct ovsdb_idl *idl, const char *remote,
> {
> if (idl) {
> ovs_assert(!idl->txn);
> + if (idl->session) {
> + jsonrpc_session_close(idl->session);
> + }
Thanks, I applied this to master.
I removed the "if" because jsonrpc_session_close() is a no-op for null
pointers.
More information about the dev
mailing list