Skip to content

Commit 11b7e92

Browse files
committed
test_astlpc: Clean up after test case
Free all allocated memory to avoid false-positive leak reports. Resolves: ==11807==ERROR: LeakSanitizer: detected memory leaks Indirect leak of 552 byte(s) in 1 object(s) allocated from: #0 0x7f74718fbae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8) #1 0x7f74717bacf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28 #2 0x7f74717b5edc in mctp_init /home/andrew/src/openbmc/libmctp/core.c:234 #3 0x56157917c7ee in main tests/test_astlpc.c:160 #4 0x7f7470c661e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2) Indirect leak of 384 byte(s) in 1 object(s) allocated from: #0 0x7f74718fbae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8) #1 0x7f74717bacf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28 #2 0x7f74717c2cd0 in __mctp_astlpc_init /home/andrew/src/openbmc/libmctp/astlpc.c:364 #3 0x7f74717c31f0 in mctp_astlpc_init_ops /home/andrew/src/openbmc/libmctp/astlpc.c:388 #4 0x56157917c88f in main tests/test_astlpc.c:165 #5 0x7f7470c661e2 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 0x7f74718fbae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8) #1 0x7f74717bacf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28 #2 0x7f74717b655f in mctp_register_bus /home/andrew/src/openbmc/libmctp/core.c:277 #3 0x56157917c903 in main tests/test_astlpc.c:167 #4 0x7f7470c661e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2) Indirect leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7f74718fbae8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8) #1 0x7f74717bacf0 in __mctp_alloc /home/andrew/src/openbmc/libmctp/alloc.c:28 #2 0x7f74717c34b2 in mctp_astlpc_init_ops /home/andrew/src/openbmc/libmctp/astlpc.c:400 #3 0x56157917c88f in main tests/test_astlpc.c:165 #4 0x7f7470c661e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2) Signed-off-by: Andrew Jeffery <[email protected]> Change-Id: I3f67e48b22948e18aea91d6fa28135e528268bc1
1 parent 4663f67 commit 11b7e92

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_astlpc.c

+4
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,9 @@ int main(void)
211211
/* Verify it's the packet we expect */
212212
assert(!memcmp(mmio.lpc + RX_BUFFER_DATA, &msg[MCTP_BTU], MCTP_BTU));
213213

214+
mctp_astlpc_destroy(astlpc);
215+
mctp_destroy(mctp);
216+
free(mmio.lpc);
217+
214218
return 0;
215219
}

0 commit comments

Comments
 (0)