vlog: fix memory leak in vlog_set_log_file() function
memory leak happens in case previously closed log file was reopened again,
for example:
ovs-appctl vlog/close
ovs-appctl vlog/reopen
memory leak is reported by valgrind in a form:
==4463== 76 bytes in 1 blocks are definitely lost in loss record 322 of 344
==4463== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4463== by 0x534314: xmalloc (util.c:138)
==4463== by 0x534384: xmemdup0 (util.c:168)
==4463== by 0x53ACB9: vlog_set_log_file (vlog.c:403)
==4463== by 0x53AEDC: vlog_reopen_log_file (vlog.c:434)
==4463== by 0x53AF22: vlog_unixctl_reopen (vlog.c:683)
==4463== by 0x533730: process_command (unixctl.c:308)
==4463== by 0x533730: run_connection (unixctl.c:342)
==4463== by 0x533730: unixctl_server_run (unixctl.c:393)
==4463== by 0x4073AE: main (ovs-vswitchd.c:128)
ovsdb-client: fix memory leak to prevent valgrind reporting memory leaks while running test suite
memory leaks are reported in several tests and are expressed in a following way:
==29840== 208 (48 direct, 160 indirect) bytes in 1 blocks are definitely lost in
loss record 43 of 44
==29840== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64
-linux.so)
==29840== by 0x449D12: xcalloc (util.c:121)
==29840== by 0x432949: jsonrpc_msg_from_json (jsonrpc.c:697)
==29840== by 0x432A8F: jsonrpc_parse_received_message (jsonrpc.c:472)
==29840== by 0x432A8F: jsonrpc_recv.part.7 (jsonrpc.c:338)
==29840== by 0x4338F7: jsonrpc_recv (jsonrpc.c:1139)
==29840== by 0x4338F7: jsonrpc_session_recv (jsonrpc.c:1112)
==29840== by 0x40719B: do_wait (ovsdb-client.c:2463)
==29840== by 0x405F76: main (ovsdb-client.c:282)