From 01a8d3bb00d9e3b242fd11f86a0bb620cf6c1fae Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 23 Jun 2021 22:23:14 +0200 Subject: [PATCH 1/2] apps: simplify logical constraints EFI_ERROR(EFI_NOT_STARTED) is true. So we can simplify (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) to (rc == EFI_NOT_STARTED) Signed-off-by: Heinrich Schuchardt --- apps/bltgrid.c | 2 +- apps/lfbgrid.c | 2 +- apps/modelist.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/bltgrid.c b/apps/bltgrid.c index 2adde6a..56d62fa 100644 --- a/apps/bltgrid.c +++ b/apps/bltgrid.c @@ -46,7 +46,7 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) UINTN SizeOfInfo; rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, &info); - if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) { + if (rc == EFI_NOT_STARTED) { Print(L"gop->QueryMode() returned %r\n", rc); Print(L"Trying to start GOP with SetMode().\n"); rc = uefi_call_wrapper(gop->SetMode, 2, gop, diff --git a/apps/lfbgrid.c b/apps/lfbgrid.c index 53a255a..0437107 100644 --- a/apps/lfbgrid.c +++ b/apps/lfbgrid.c @@ -70,7 +70,7 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) UINTN SizeOfInfo; rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, &info); - if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) { + if (rc == EFI_NOT_STARTED) { Print(L"gop->QueryMode() returned %r\n", rc); Print(L"Trying to start GOP with SetMode().\n"); rc = uefi_call_wrapper(gop->SetMode, 2, gop, diff --git a/apps/modelist.c b/apps/modelist.c index 26892e1..13219b7 100644 --- a/apps/modelist.c +++ b/apps/modelist.c @@ -22,7 +22,7 @@ print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) UINTN SizeOfInfo; rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, &info); - if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) { + if (rc == EFI_NOT_STARTED) { Print(L"gop->QueryMode() returned %r\n", rc); Print(L"Trying to start GOP with SetMode().\n"); rc = uefi_call_wrapper(gop->SetMode, 2, gop, From 4fe83e102674192c2f0c18ef2db8a427bd8c4b6c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 23 Jun 2021 23:22:41 +0200 Subject: [PATCH 2/2] apps: memory leak in draw_boxes() Free the buffer allocated to draw boxes. Signed-off-by: Heinrich Schuchardt --- apps/bltgrid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/bltgrid.c b/apps/bltgrid.c index 56d62fa..4500fbb 100644 --- a/apps/bltgrid.c +++ b/apps/bltgrid.c @@ -84,6 +84,7 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) info->HorizontalResolution, info->VerticalResolution, 0); + FreePool(PixelBuffer); return; } Print(L"Never found the active video mode?\n");