diff options
| author | Peter Jones <pjones@redhat.com> | 2015-11-17 11:40:23 -0500 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2015-11-17 11:40:23 -0500 |
| commit | b7e59fd9875efe17514310dbba9b62d911223b52 (patch) | |
| tree | ffe2818adfdd5bd06dd607bbf9de9e855d6afe2c /shim.c | |
| parent | d4fee90cdcb02de62cdd9d906c13bbd8e0c925d3 (diff) | |
| download | efi-boot-shim-b7e59fd9875efe17514310dbba9b62d911223b52.tar.gz efi-boot-shim-b7e59fd9875efe17514310dbba9b62d911223b52.zip | |
shim: fix resource leak on should_use_fallback() error path
ExitBootServices() and Exit() should both clean these up anyway, but we
should do the right thing nonetheless.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'shim.c')
| -rw-r--r-- | shim.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1270,8 +1270,8 @@ should_use_fallback(EFI_HANDLE image_handle) unsigned int pathlen = 0; CHAR16 *bootpath = NULL; EFI_FILE_IO_INTERFACE *fio = NULL; - EFI_FILE *vh; - EFI_FILE *fh; + EFI_FILE *vh = NULL; + EFI_FILE *fh = NULL; EFI_STATUS rc; int ret = 0; @@ -1322,11 +1322,13 @@ should_use_fallback(EFI_HANDLE image_handle) uefi_call_wrapper(vh->Close, 1, vh); goto error; } - uefi_call_wrapper(fh->Close, 1, fh); - uefi_call_wrapper(vh->Close, 1, vh); ret = 1; error: + if (fh) + uefi_call_wrapper(fh->Close, 1, fh); + if (vh) + uefi_call_wrapper(vh->Close, 1, vh); if (bootpath) FreePool(bootpath); |
