Skip to content

Commit

Permalink
test_eid: Clean up after test case
Browse files Browse the repository at this point in the history
Free all allocated memory to avoid false-positive leak reports.
Resolves:

    ==10460==ERROR: LeakSanitizer: detected memory leaks

    Indirect leak of 552 byte(s) in 1 object(s) allocated from:
        #0 0x7f3e1a574ae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8)
        #1 0x7f3e1a433cf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28
        #2 0x7f3e1a42eedc in mctp_init /home/andrew/src/openbmc/libmctp/core.c:234
        #3 0x55f705f81268 in mctp_test_stack_init tests/test-utils.c:63
        #4 0x55f705f7edff in main tests/test_eid.c:51
        #5 0x7f3e198df1e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2)

    Indirect leak of 56 byte(s) in 1 object(s) allocated from:
        #0 0x7f3e1a574ae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8)
        #1 0x7f3e1a433cf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28
        #2 0x55f705f80c99 in mctp_binding_test_init tests/test-utils.c:27
        #3 0x55f705f812e1 in mctp_test_stack_init tests/test-utils.c:66
        #4 0x55f705f7edff in main tests/test_eid.c:51
        #5 0x7f3e198df1e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2)

    Indirect leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x7f3e1a574ae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8)
        #1 0x7f3e1a433cf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28
        #2 0x7f3e1a42f55f in mctp_register_bus /home/andrew/src/openbmc/libmctp/core.c:277
        #3 0x55f705f8121b in mctp_binding_test_register_bus tests/test-utils.c:56
        #4 0x55f705f81405 in mctp_test_stack_init tests/test-utils.c:69
        #5 0x55f705f7edff in main tests/test_eid.c:51
        #6 0x7f3e198df1e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2)

Signed-off-by: Andrew Jeffery <[email protected]>
Change-Id: I34eae31219d4a31e8388d180be746ae8b7ec5c04
  • Loading branch information
amboar committed Mar 10, 2020
1 parent c68d96e commit 7c73801
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_eid.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ int main(void)

assert(ctx->rx_count == 0);

mctp_binding_test_destroy(ctx->binding);
mctp_destroy(ctx->mctp);

return EXIT_SUCCESS;
}

0 comments on commit 7c73801

Please sign in to comment.