diff options
author | Ales Musil <amusil@redhat.com> | 2023-02-15 09:38:12 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-02-15 18:18:44 +0100 |
commit | 9e0f27cc97330eef7dba7548385e150235b63a54 (patch) | |
tree | 69da873716d243da824c032e0d82384f24ce3239 | |
parent | 30faa8c2a443212797167a42aa8f6ee50eb791a6 (diff) | |
download | openvswitch-9e0f27cc97330eef7dba7548385e150235b63a54.tar.gz |
dpctl: Fix memory leak in flush conntrack.
Direct leak of 36 byte(s) in 1 object(s) allocated from:
0 0x527d90 in __interceptor_realloc.part.0 asan_malloc_linux.cpp.o
1 0xc5f9fc in xrealloc__ lib/util.c:147:9
2 0xc5f9fc in xrealloc lib/util.c:179:12
3 0x86845d in ds_reserve lib/dynamic-string.c:63:22
4 0x86954a in ds_put_format_valist lib/dynamic-string.c:164:9
5 0x869202 in ds_put_format lib/dynamic-string.c:142:5
6 0x7dc664 in ct_dpif_parse_tuple lib/ct-dpif.c
7 0xebb089 in dpctl_flush_conntrack lib/dpctl.c:1717:17
8 0xeb4eb2 in dpctl_unixctl_handler lib/dpctl.c:3035:17
9 0xc5d4f8 in process_command lib/unixctl.c:310:13
10 0xc5d4f8 in run_connection lib/unixctl.c:344:17
11 0xc5d4f8 in unixctl_server_run lib/unixctl.c:395:21
12 0x5a643f in main vswitchd/ovs-vswitchd.c:130:9
Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/dpctl.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/dpctl.c b/lib/dpctl.c index 29041fa3e..742fbce2d 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -1727,26 +1727,23 @@ dpctl_flush_conntrack(int argc, const char *argv[], /* Report error if there are more than one unparsed argument. */ if (args > 1) { - ds_put_cstr(&ds, "invalid arguments"); error = EINVAL; - goto error; + dpctl_error(dpctl_p, error, "invalid arguments: %s", ds_cstr(&ds)); + goto out; } error = opt_dpif_open(argc, argv, dpctl_p, 4, &dpif); if (error) { - return error; + goto out; } error = ct_dpif_flush(dpif, pzone, ptuple); - if (!error) { - dpif_close(dpif); - return 0; - } else { - ds_put_cstr(&ds, "failed to flush conntrack"); + if (error) { + dpctl_error(dpctl_p, error, "failed to flush conntrack: %s", + ds_cstr(&ds)); } -error: - dpctl_error(dpctl_p, error, "%s", ds_cstr(&ds)); +out: ds_destroy(&ds); dpif_close(dpif); return error; |