From df3faf4d095a4a5eaa93d1e13f69fa92d4aa14fe Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 9 Dec 2008 17:48:50 +0000 Subject: Fix some memory leaks. --- src/slot.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/slot.c') diff --git a/src/slot.c b/src/slot.c index 9658ea6..ea4bf15 100644 --- a/src/slot.c +++ b/src/slot.c @@ -235,6 +235,9 @@ test_slot_info(void) if(memcmp(only, present, sizeof(CK_SLOT_ID) * n_only) != 0) P11T_CHECK_FAIL("Present tokens don't match those in token info flags. ie: CKF_TOKEN_PRESENT"); + free(only); + free(present); + return CONTINUE; } @@ -316,7 +319,6 @@ test_slot_mechanisms(void) } } - /* - */ if(p11t_test_unexpected) value = mech_count + 5; else @@ -389,6 +391,38 @@ p11t_slot_tests(void) test_slot_mechanisms(); } +void +p11t_slot_cleanup(void) +{ + CK_ULONG i; + + free(slot_ids); + slot_ids = NULL; + + for(i = 0; i < p11t_slot_count; ++i) + { + free(slot_mech_type[i]); + free(slot_mech_info[i]); + } + + free(slot_info); + slot_info = NULL; + + free(slot_token_info); + slot_token_info = NULL; + + free(slot_mech_count); + slot_mech_count = NULL; + + free(slot_mech_type); + slot_mech_type = NULL; + + free(slot_mech_info); + slot_mech_info = NULL; + + p11t_slot_count = 0; +} + /* ---------------------------------------------------------------------------------- * METHODS */ -- cgit v1.2.3