:: commit b261742d0297c474b8a12fc581c7465ff5599d4c

Mintsuki <mintsuki@protonmail.com> — 2026-05-06 03:53

parents: 6a053a7847

drivers/gop: Free handle buffer with original alloc size after LocateHandle

diff --git a/common/drivers/gop.c b/common/drivers/gop.c
index 7c8ca619..59a19043 100644
--- a/common/drivers/gop.c
+++ b/common/drivers/gop.c
@@ -237,11 +237,12 @@ void init_gop(struct fb_info **ret, size_t *_fbs_count,
         return;
     }
 
-    handles = ext_mem_alloc(handles_size);
+    UINTN handles_alloc = handles_size;
+    handles = ext_mem_alloc(handles_alloc);
 
     status = gBS->LocateHandle(ByProtocol, &gop_guid, NULL, &handles_size, handles);
     if (status != EFI_SUCCESS) {
-        pmm_free(handles, handles_size);
+        pmm_free(handles, handles_alloc);
         *_fbs_count = 0;
         return;
     }
@@ -371,7 +372,7 @@ success:;
         fbs_count++;
     }
 
-    pmm_free(handles, handles_size);
+    pmm_free(handles, handles_alloc);
 
     gop_force_16 = false;
 
tab: 248 wrap: offon