Skip to content

Commit

Permalink
pkcs15-cflex: Free file in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
xhanulik authored and frankmorgner committed Jan 29, 2024
1 parent 718f1d4 commit 77c8fa2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/pkcs15init/pkcs15-cflex.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,11 @@ cflex_create_pin_file(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
LOG_TEST_RET(ctx, r, "Failed to create PIN file");

r = sc_update_binary(p15card->card, 0, buffer, 23, 0);
LOG_TEST_RET(ctx, r, "Failed to update PIN file");

if (r < 0 || file_ret == NULL)
sc_file_free(file);
else
*file_ret = file;
LOG_TEST_RET(ctx, r, "Failed to update PIN file");

/* Delete the dummy CHV files */
cflex_delete_dummy_chvs(profile, p15card, ndummies, dummies);
Expand Down

0 comments on commit 77c8fa2

Please sign in to comment.