ovn-controller: Fix memory leak reported by valgrind.
authorWilliam Tu <u9012063@gmail.com>
Sun, 5 Jun 2016 14:37:35 +0000 (07:37 -0700)
committerBen Pfaff <blp@ovn.org>
Fri, 10 Jun 2016 15:44:26 +0000 (08:44 -0700)
commit634f6c29a7268747a806e0c9230dcfeae6e3b48f
treeea788d9f0642ae95f3b1ebca6b2eecc5db81f107
parent1cece4ad5eb26e90a99485a776cb2b2119588bd6
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>
lib/ovsdb-idl.c