fixed error checking

closes https://github.com/OpenSC/OpenSC/pull/1343
This commit is contained in:
Frank Morgner 2018-09-25 11:09:07 +02:00
parent 0c3412bb37
commit 0ae825f8d9
1 changed files with 3 additions and 0 deletions

View File

@ -3320,6 +3320,9 @@ sc_pkcs15init_change_attrib(struct sc_pkcs15_card *p15card, struct sc_profile *p
LOG_TEST_RET(ctx, r, "Failed to store new data");
nv = (u8 *) malloc (new_len * sizeof(u8));
if (!nv) {
LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY);
}
memcpy(nv, new_value, new_len * sizeof(u8));
free(info->data.value);
/* set object members to represent new CKA_VALUE value,