pkcs11-tool: Avoid double free and check allocation
366349 Double free Thanks coverity
This commit is contained in:
parent
ae1cf0be90
commit
2f232f217b
|
@ -7319,8 +7319,12 @@ static void * test_threads_run(void * pttd)
|
|||
fprintf(stderr, "Test thread %d l_p11_num_slots:%ld\n", ttd->tnum, l_p11_num_slots);
|
||||
if (rv == CKR_OK) {
|
||||
free(l_p11_slots);
|
||||
l_p11_slots = NULL;
|
||||
if (l_p11_num_slots > 0) {
|
||||
l_p11_slots = calloc(l_p11_num_slots, sizeof(CK_SLOT_ID));
|
||||
if (l_p11_slots == NULL) {
|
||||
goto err;
|
||||
}
|
||||
fprintf(stderr, "Test thread %d C_GetSlotList\n", ttd->tnum);
|
||||
rv = p11->C_GetSlotList(1, l_p11_slots, &l_p11_num_slots);
|
||||
ttd->rv = rv;
|
||||
|
|
Loading…
Reference in New Issue