Skip to content

Commit

Permalink
Remove unneeded NULL check
Browse files Browse the repository at this point in the history
Fixes Coverity CID 379845
  • Loading branch information
mtrojnar committed Mar 14, 2024
1 parent 7acc436 commit dcd7ea2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examples/listkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void error_queue(const char *name);

int main(int argc, char *argv[])
{
PKCS11_CTX *ctx=NULL;
PKCS11_CTX *ctx;
PKCS11_SLOT *slots=NULL, *slot;
PKCS11_KEY *keys;
unsigned int nslots, nkeys;
Expand Down Expand Up @@ -127,10 +127,8 @@ int main(int argc, char *argv[])
end:
if (slots)
PKCS11_release_all_slots(ctx, slots, nslots);
if (ctx) {
PKCS11_CTX_unload(ctx);
PKCS11_CTX_free(ctx);
}
PKCS11_CTX_unload(ctx);
PKCS11_CTX_free(ctx);

if (rc)
printf("Failed (error code %d).\n", rc);
Expand Down

0 comments on commit dcd7ea2

Please sign in to comment.