From 4665fcab6216c593b3e37e035697a53101615558 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Tue, 30 Apr 2013 11:58:51 +0800 Subject: [PATCH] Fix crash due to memory allocation --- fallback.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fallback.c b/fallback.c index 0001722..5ba0b79 100644 --- a/fallback.c +++ b/fallback.c @@ -95,7 +95,7 @@ make_full_path(CHAR16 *dirname, CHAR16 *filename, CHAR16 **out, UINT64 *outlen) len = StrLen(dirname) + StrLen(filename) + StrLen(L"\\EFI\\\\") + 2; - CHAR16 *fullpath = AllocateZeroPool(len); + CHAR16 *fullpath = AllocateZeroPool(len*sizeof(CHAR16)); if (!fullpath) { Print(L"Could not allocate memory\n"); return EFI_OUT_OF_RESOURCES; @@ -286,11 +286,8 @@ add_to_boot_list(EFI_FILE_HANDLE fh, CHAR16 *dirname, CHAR16 *filename, CHAR16 * #endif add_boot_option(dp, fullpath, label, arguments); - FreePool(fullpath); err: - if (dph) - FreePool(dph); if (dpf) FreePool(dpf); if (dp)