pkcs15-authentic.c: fixed potential resource leak

This commit is contained in:
Frank Morgner 2015-10-09 23:37:21 +02:00
parent f9a73c0b20
commit 7e29fcd26c
1 changed files with 5 additions and 3 deletions

View File

@ -350,8 +350,10 @@ authentic_sdo_allocate_prvkey(struct sc_profile *profile, struct sc_card *card,
LOG_TEST_RET(ctx, rv, "Cannot instantiate new PRKEY-RSA file");
sdo = calloc(1, sizeof(struct sc_authentic_sdo));
if (!sdo)
if (!sdo) {
sc_file_free(file);
LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, "Cannot allocate 'sc_authentic_sdo'");
}
*out = sdo;
sdo->magic = AUTHENTIC_SDO_MAGIC;