From bc6469c4fd576c698bab9c8b620de00d7ba1fe1a Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 20 Sep 2016 16:48:16 +0200 Subject: [PATCH] test: Fix memleak in test-token cleanup GCC's asan spotted this: Direct leak of 338 byte(s) in 13 object(s) allocated from: #0 0x7f54f03fee20 in malloc (/lib64/libasan.so.3+0xc6e20) #1 0x445e8c in p11_path_build ../common/path.c:222 #2 0x4385bd in expand_tempdir ../common/test.c:334 #3 0x43869c in p11_test_directory ../common/test.c:361 #4 0x4033e3 in setup_temp ../trust/test-token.c:79 --- trust/test-token.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trust/test-token.c b/trust/test-token.c index d4c89ce..d557980 100644 --- a/trust/test-token.c +++ b/trust/test-token.c @@ -84,7 +84,6 @@ static void teardown (void *path) { p11_token_free (test.token); - memset (&test, 0, sizeof (test)); } static void @@ -93,6 +92,7 @@ teardown_temp (void *unused) p11_test_directory_delete (test.directory); teardown (test.directory); free (test.directory); + memset (&test, 0, sizeof (test)); } static void -- 2.40.0