framework-pkcs15: Avoid leaking memory when create object fails
This commit is contained in:
parent
96ae693d5a
commit
219c6cc494
|
@ -833,10 +833,14 @@ __pkcs15_create_profile_object(struct pkcs15_fw_data *fw_data,
|
||||||
|
|
||||||
rv = __pkcs15_create_object(fw_data, (struct pkcs15_any_object **) &pobj,
|
rv = __pkcs15_create_object(fw_data, (struct pkcs15_any_object **) &pobj,
|
||||||
obj, &pkcs15_profile_ops, sizeof(struct pkcs15_profile_object));
|
obj, &pkcs15_profile_ops, sizeof(struct pkcs15_profile_object));
|
||||||
if (rv >= 0) {
|
|
||||||
pobj->profile_id = public_certificates ? CKP_PUBLIC_CERTIFICATES_TOKEN : CKP_AUTHENTICATION_TOKEN;
|
if (rv != SC_SUCCESS) {
|
||||||
|
free(obj);
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pobj->profile_id = public_certificates ? CKP_PUBLIC_CERTIFICATES_TOKEN : CKP_AUTHENTICATION_TOKEN;
|
||||||
|
|
||||||
if (profile_object != NULL)
|
if (profile_object != NULL)
|
||||||
*profile_object = (struct pkcs15_any_object *) pobj;
|
*profile_object = (struct pkcs15_any_object *) pobj;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue