diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2020-05-14 22:10:45 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2020-05-28 11:46:39 +0200 |
commit | 16e3a80cf646f6c53d22ef98599d5aecb8310414 (patch) | |
tree | aaf5d007ec5b6042eddfc9001a05d11f29aef8f2 /ovsdb/raft-private.h | |
parent | ede446678f5da3ef4be5e3f6de0702e62342b833 (diff) | |
download | openvswitch-16e3a80cf646f6c53d22ef98599d5aecb8310414.tar.gz |
ovsdb-server: Fix schema leak while reading db.
parse_txn() function doesn't always take ownership of the 'schema'
passed. So, if the schema of the clustered db has same version as the
one that already in use, parse_txn() will not use it, resulting with a
memory leak:
7,827 (56 direct, 7,771 indirect) bytes in 1 blocks are definitely lost
at 0x483BB1A: calloc (vg_replace_malloc.c:762)
by 0x44AD02: xcalloc (util.c:121)
by 0x40E70E: ovsdb_schema_create (ovsdb.c:41)
by 0x40EA6D: ovsdb_schema_from_json (ovsdb.c:217)
by 0x415EDD: ovsdb_storage_read (storage.c:280)
by 0x408968: read_db (ovsdb-server.c:607)
by 0x40733D: main_loop (ovsdb-server.c:227)
by 0x40733D: main (ovsdb-server.c:469)
While we could put ovsdb_schema_destroy() in a few places inside
'parse_txn()', from the users' point of view it seems better to have a
constant argument and just clone the 'schema' if needed. The caller
will be responsible for destroying the 'schema' it owns.
Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
Acked-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb/raft-private.h')
0 files changed, 0 insertions, 0 deletions