Fix: tests: free message iterator class in test_graph_topo.c
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 8 Mar 2023 21:54:25 +0000 (16:54 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 10 Mar 2023 16:39:55 +0000 (11:39 -0500)
commit44b263a86c5d6ead7e68191c330ee835bd19ea7d
tree28eee43220d70d4b89b5f83f2584bfb6878ae4af
parent6ec97181a525a3cd64cedbcd0df905ed9e84ba03
Fix: tests: free message iterator class in test_graph_topo.c

In a build with --enable-asan and optimizations (-O2), I see:

    Direct leak of 112 byte(s) in 1 object(s) allocated from:
        #0 0x7fc88d6bf411 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
        #1 0x7fc88d3b4631 in g_malloc0 (/usr/lib/libglib-2.0.so.0+0x53631)
        #2 0x563fdbbb98c7 in init_test /home/smarchi/src/babeltrace/tests/lib/test_graph_topo.c:330
        #3 0x563fdbbb98c7 in main /home/smarchi/src/babeltrace/tests/lib/test_graph_topo.c:711
        #4 0x7fc88d19d78f  (/usr/lib/libc.so.6+0x2378f)

For some reason, that leak does not show up on a -O0 build.  Anyhow,
call BT_MESSAGE_ITERATOR_CLASS_PUT_REF_AND_RESET, it's the right thing
to do to clean things up.

Change-Id: I875d8961c2eb4915fbc13706b9148151e82e26d8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9626
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/lib/test_graph_topo.c
This page took 0.024004 seconds and 4 git commands to generate.