Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Fix illegal destroy_enclave if epm_init fails. #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions keystone-enclave.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,19 @@ struct enclave* create_enclave(unsigned long min_pages)
if (!enclave->epm)
{
keystone_err("failed to allocate epm\n");
goto error_destroy_enclave;
goto error_free_enclave;
}

if(epm_init(enclave->epm, min_pages)) {
keystone_err("failed to initialize epm\n");
goto error_destroy_enclave;
goto error_free_epm;
}
return enclave;

error_destroy_enclave:
destroy_enclave(enclave);
error_free_epm:
kfree(enclave->epm);
error_free_enclave:
kfree(enclave);
error_no_free:
return NULL;
}
Expand Down