diff options
Diffstat (limited to 'src/slot.c')
-rw-r--r-- | src/slot.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,6 +1,4 @@ -#include "config.h" - #include "p11-tests.h" #include <stdlib.h> @@ -43,7 +41,7 @@ test_slot_global(void) /** - Normal call */ rv = (p11t_module_funcs->C_GetInfo)(&slot_global); - if(p11t_check_returns("C_GetInfo", rv, CKR_OK)) + if(!p11t_check_returns("C_GetInfo", rv, CKR_OK)) { memset(&slot_global, 0, sizeof(CK_INFO)); return; @@ -307,6 +305,9 @@ test_slot_mechanisms(void) rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, NULL, &mech_count); p11t_check_returns("C_GetMechanismList: without buffer", rv, CKR_OK); + mech_list = NULL; + mech_info = NULL; + if(mech_count > 0) { mech_list = calloc(mech_count + 5, sizeof(CK_MECHANISM_TYPE)); @@ -377,9 +378,9 @@ test_slot_mechanisms(void) p11t_check_nflag("CK_MECHANISM_INFO.flags", mech_info[i].flags, CKF_EXTENSION); } - slot_mech_info[i] = mech_info; } + slot_mech_info[i] = mech_info; slot_mech_type[i] = mech_list; slot_mech_count[i] = mech_count; } @@ -424,7 +425,7 @@ get_slot_index(CK_SLOT_ID slot) CK_SLOT_ID p11t_slot_get_id(int index) { - if(index >= p11t_slot_count) + if(index >= (int)p11t_slot_count) return CK_INVALID; return slot_ids[index]; } |