The memory leak reported by GCC with sanitizers (below) is a false
positive in a way, the process is ending before the free of the
options is called so it doesn't cause any harm. It is freed properly
in a flow where the process keeps running. The opt to skip rather
than call the free is that certain options lead to direct exit
without proper free and fixing all of them would probably cause
more harm, on the code readability front, than good.
Direct leak of 49 byte(s) in 1 object(s) allocated from:
malloc (/workspace/ovn-tmp/northd/ovn-northd+0x787e1f)
xmalloc__ lib/util.c:141
xmalloc lib/util.c:176
xmemdup0 lib/util.c:197
xstrdup lib/util.c:206
ovs_cmdl_long_options_to_short_options lib/command-line.c:53
parse_options northd/ovn-northd.c:660
main northd/ovn-northd.c:870
Signed-off-by: Ales Musil <[email protected]>
---
tests/ovn-inc-proc-graph-dump.at | 8 ++++++++
tests/ovn-macros.at | 13 +++++++++++++
2 files changed, 21 insertions(+)
diff --git a/tests/ovn-inc-proc-graph-dump.at b/tests/ovn-inc-proc-graph-dump.at
index eb00ccc7d..2433977f6 100644
--- a/tests/ovn-inc-proc-graph-dump.at
+++ b/tests/ovn-inc-proc-graph-dump.at
@@ -2,6 +2,8 @@ AT_BANNER([OVN Incremental Processing Engine Graph Dump])
AT_SETUP([northd: dump full incremental processing graph])
AT_KEYWORDS([inc-proc-graph])
+
+OVN_SKIP_MEM_LEAK([ovs_cmdl_long_options_to_short_options])
AT_CHECK([ovn-northd --dump-inc-proc-graph], [0], [dnl
digraph "Incremental-Processing-Engine" {
rankdir=LR;
@@ -244,6 +246,8 @@ AT_CLEANUP
AT_SETUP([northd: dump partial incremental processing graph (up to
datapath_sync)])
AT_KEYWORDS([inc-proc-graph])
+
+OVN_SKIP_MEM_LEAK([ovs_cmdl_long_options_to_short_options])
AT_CHECK([ovn-northd --dump-inc-proc-graph=datapath_sync], [0], [dnl
digraph "Incremental-Processing-Engine" {
rankdir=LR;
@@ -278,6 +282,8 @@ AT_CLEANUP
AT_SETUP([controller: dump full incremental processing graph])
AT_KEYWORDS([inc-proc-graph])
+
+OVN_SKIP_MEM_LEAK([ovs_cmdl_long_options_to_short_options])
AT_CHECK([ovn-controller --dump-inc-proc-graph], [0], [dnl
digraph "Incremental-Processing-Engine" {
rankdir=LR;
@@ -483,6 +489,8 @@ AT_CLEANUP
AT_SETUP([controller: dump partial incremental processing graph (up to
runtime_data)])
AT_KEYWORDS([inc-proc-graph])
+
+OVN_SKIP_MEM_LEAK([ovs_cmdl_long_options_to_short_options])
AT_CHECK([ovn-controller --dump-inc-proc-graph=runtime_data], [0], [dnl
digraph "Incremental-Processing-Engine" {
rankdir=LR;
diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 29ba14bef..1c981e5a8 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -1537,6 +1537,19 @@ check ovn-appctl -t ovn-controller exit $2])
OVS_WAIT_WHILE([kill -0 $TMPPID 2>/dev/null])
])
+# OVN_SKIP_MEM_LEAK([leak ...])
+#
+# Skip memory leak, it can be function name, file path etc.
+m4_define([OVN_SKIP_MEM_LEAK],[
+ m4_foreach([def], [$@], [
+ echo "leak:def" >> ovn_leak_suppression.txt
+ ])
+
+ LSAN_OPTIONS=$LSAN_OPTIONS:suppressions=ovn_leak_suppression.txt
+ LSAN_OPTIONS=$LSAN_OPTIONS:print_suppressions=0
+ export LSAN_OPTIONS
+])
+
m4_define([OFTABLE_PHY_TO_LOG], [0])
m4_define([OFTABLE_LOG_INGRESS_PIPELINE], [8])
m4_define([OFTABLE_OUTPUT_LARGE_PKT_DETECT], [41])
--
2.52.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev