Skip to content

Commit

Permalink
'cur' may have been freed by sbrk heap free, so deref ->previous early
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Feb 8, 2024
1 parent a868d5c commit 0190114
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ void efi_register_exit_hook(void (*callback)(void *), void * data) {
void efi_run_exit_hooks(void) {
struct ExitHook * cur = tail;
while (cur) {
struct ExitHook * next = cur->previous;
cur->callback(cur->data);
cur = cur->previous;
cur = next;
}
}

Expand Down Expand Up @@ -225,6 +226,5 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)

/* We're returning to EFI, free the resources we used. */
efi_run_exit_hooks();

return 0;
}

0 comments on commit 0190114

Please sign in to comment.