2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ovn-controller: Fix memory leak reported by valgrind.

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@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
This commit is contained in:
William Tu
2016-06-05 07:37:35 -07:00
committed by Ben Pfaff
parent 1cece4ad5e
commit 634f6c29a7

View File

@@ -286,6 +286,7 @@ ovsdb_idl_set_remote(struct ovsdb_idl *idl, const char *remote,
{
if (idl) {
ovs_assert(!idl->txn);
jsonrpc_session_close(idl->session);
idl->session = jsonrpc_session_open(remote, retry);
idl->state_seqno = UINT_MAX;
}