[ovs-dev,1/1] test-ovn: fix memory leak
diff mbox series

Message ID 1581587098-27905-1-git-send-email-damjan.skvarc@gmail.com
State New
Headers show
  • [ovs-dev,1/1] test-ovn: fix memory leak
Related show

Commit Message

Damijan Skvarc Feb. 13, 2020, 9:44 a.m. UTC
Many memory leaks were detected by valgrind while running 
"3-term numeric expression simplification" unit test. All of them
are reported in a form similar to:

==25922== 57,071,464 bytes in 192,809 blocks are definitely lost in loss record 70 of 70
==25922==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25922==    by 0x468604: xmalloc (util.c:138)
==25922==    by 0x5354B1: expr_create_boolean (expr.c:222)
==25922==    by 0x5354B1: expr_fix_andor (expr.c:268)
==25922==    by 0x536F0F: expr_simplify (expr.c:2108)
==25922==    by 0x409C73: test_tree_shape_exhaustively (test-ovn.c:914)
==25922==    by 0x40A83E: test_exhaustive (test-ovn.c:1140)
==25922==    by 0x4110D3: ovs_cmdl_run_command__ (command-line.c:247)
==25922==    by 0x407B01: test_ovn_main (test-ovn.c:1623)
==25922==    by 0x407B01: ovstest_wrapper_test_ovn_main__ (test-ovn.c:1626)
==25922==    by 0x4110D3: ovs_cmdl_run_command__ (command-line.c:247)
==25922==    by 0x4066B9: main (ovstest.c:133)

The problem was in test_tree_shape_exhaustively() function which 
overides pointer to temporary allocated expression without freeing it first.

Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>

 tests/test-ovn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


0-day Robot Feb. 13, 2020, 9:56 a.m. UTC | #1
Bleep bloop.  Greetings Damijan Skvarc, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.

fatal: sha1 information is lacking or useless (tests/test-ovn.c).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 test-ovn: fix memory leak
The copy of the patch that failed is found in:
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Please check this out.  If you feel there has been an error, please email aconole@redhat.com

0-day Robot

diff mbox series

diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 8ef886d..c607a8f 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -913,7 +913,7 @@  test_tree_shape_exhaustively(struct expr *expr, struct shash *symtab,
         } else if (operation >= OP_SIMPLIFY) {
             modified = expr_simplify(expr_clone(expr));
             modified = expr_evaluate_condition(
-                expr_clone(modified), tree_shape_is_chassis_resident_cb, NULL);
+                modified, tree_shape_is_chassis_resident_cb, NULL);
             if (operation >= OP_NORMALIZE) {