mirror of
https://github.com/openvswitch/ovs
synced 2025-08-29 13:27:59 +00:00
ovsdb-idl: memory leak while destroying database
While checking unit tests with valgrind option (make check-valgrind) I have noticed several memory leaks of the following format: ..... ==20019== 13,883 (296 direct, 13,587 indirect) bytes in 1 blocks are definitely lost in loss record 346 of 346 ==20019== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==20019== by 0x530F52: xcalloc (util.c:121) ==20019== by 0x5037A1: ovsdb_idl_row_create__ (ovsdb-idl.c:3120) ==20019== by 0x5045A3: ovsdb_idl_row_create (ovsdb-idl.c:3133) ==20019== by 0x507240: ovsdb_idl_process_update2 (ovsdb-idl.c:2478) ==20019== by 0x507240: ovsdb_idl_db_parse_update__ (ovsdb-idl.c:2328) ==20019== by 0x507240: ovsdb_idl_db_parse_update (ovsdb-idl.c:2380) ==20019== by 0x508128: ovsdb_idl_process_response (ovsdb-idl.c:742) ==20019== by 0x508128: ovsdb_idl_process_msg (ovsdb-idl.c:831) ==20019== by 0x508128: ovsdb_idl_run (ovsdb-idl.c:915) ==20019== by 0x4106D9: bridge_run (bridge.c:2977) ==20019== by 0x40719C: main (ovs-vswitchd.c:127) ==20019== ==20019== LEAK SUMMARY: ==20019== definitely lost: 296 bytes in 1 blocks ==20019== indirectly lost: 13,587 bytes in 10 blocks ==20019== possibly lost: 0 bytes in 0 blocks ==20019== still reachable: 43,563 bytes in 440 blocks ==20019== suppressed: 288 bytes in 1 blocks .... The problem is that table records maintained by database which is going to be destroyed with ovsdb_idl_db_destroy() function are not destroyed. Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
parent
b5e8f2053d
commit
f42a37b08d
@ -239,6 +239,7 @@ static bool ovsdb_idl_check_server_db(struct ovsdb_idl *);
|
|||||||
static void ovsdb_idl_send_monitor_request(struct ovsdb_idl *,
|
static void ovsdb_idl_send_monitor_request(struct ovsdb_idl *,
|
||||||
struct ovsdb_idl_db *,
|
struct ovsdb_idl_db *,
|
||||||
enum ovsdb_idl_monitor_method);
|
enum ovsdb_idl_monitor_method);
|
||||||
|
static void ovsdb_idl_db_clear(struct ovsdb_idl_db *db);
|
||||||
|
|
||||||
struct ovsdb_idl {
|
struct ovsdb_idl {
|
||||||
struct ovsdb_idl_db server;
|
struct ovsdb_idl_db server;
|
||||||
@ -557,6 +558,7 @@ ovsdb_idl_db_destroy(struct ovsdb_idl_db *db)
|
|||||||
{
|
{
|
||||||
ovs_assert(!db->txn);
|
ovs_assert(!db->txn);
|
||||||
ovsdb_idl_db_txn_abort_all(db);
|
ovsdb_idl_db_txn_abort_all(db);
|
||||||
|
ovsdb_idl_db_clear(db);
|
||||||
for (size_t i = 0; i < db->class_->n_tables; i++) {
|
for (size_t i = 0; i < db->class_->n_tables; i++) {
|
||||||
struct ovsdb_idl_table *table = &db->tables[i];
|
struct ovsdb_idl_table *table = &db->tables[i];
|
||||||
ovsdb_idl_condition_destroy(&table->condition);
|
ovsdb_idl_condition_destroy(&table->condition);
|
||||||
@ -581,7 +583,6 @@ ovsdb_idl_destroy(struct ovsdb_idl *idl)
|
|||||||
if (idl) {
|
if (idl) {
|
||||||
ovsdb_idl_clear(idl);
|
ovsdb_idl_clear(idl);
|
||||||
jsonrpc_session_close(idl->session);
|
jsonrpc_session_close(idl->session);
|
||||||
|
|
||||||
ovsdb_idl_db_destroy(&idl->server);
|
ovsdb_idl_db_destroy(&idl->server);
|
||||||
ovsdb_idl_db_destroy(&idl->data);
|
ovsdb_idl_db_destroy(&idl->data);
|
||||||
json_destroy(idl->request_id);
|
json_destroy(idl->request_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user