git: bbee544312e7 - main - loader.efi: Fix memory leak in efihttp_dev_close
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 12 Sep 2026 18:19:11 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=bbee544312e730e438c57e4d5777bd0687ea6b77
commit bbee544312e730e438c57e4d5777bd0687ea6b77
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-09-11 15:23:42 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-09-12 16:59:16 +0000
loader.efi: Fix memory leak in efihttp_dev_close
Save enough context to free the host we allocated in open on close.
Fixes: 6788e42d53c6
Noticed by: claude + Sonet 5
Sponsored by: Netflix
---
stand/efi/libefi/efihttp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/stand/efi/libefi/efihttp.c b/stand/efi/libefi/efihttp.c
index f725ba0709d8..6b098ff30df8 100644
--- a/stand/efi/libefi/efihttp.c
+++ b/stand/efi/libefi/efihttp.c
@@ -649,12 +649,12 @@ static int
efihttp_dev_close(struct open_file *f)
{
EFI_SERVICE_BINDING_PROTOCOL *sb;
- struct devdesc *dev;
+ struct http_devdesc *hd;
struct open_efihttp *oh;
EFI_STATUS status;
- dev = (struct devdesc *)f->f_devdata;
- oh = (struct open_efihttp *)dev->d_opendata;
+ hd = (struct http_devdesc *)f->f_devdata;
+ oh = (struct open_efihttp *)hd->dd.d_opendata;
status = BS->OpenProtocol(oh->dev_handle, &httpsb_guid, (void **)&sb,
IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(status))
@@ -662,7 +662,9 @@ efihttp_dev_close(struct open_file *f)
sb->DestroyChild(sb, oh->http_handle);
free(oh->uri_base);
free(oh);
- dev->d_opendata = NULL;
+ hd->dd.d_opendata = NULL;
+ free(hd->host);
+ hd->host = NULL;
return (0);
}