All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_loader: memory leak efi_add_memory_map_pg
@ 2023-07-30 11:05 Heinrich Schuchardt
  2023-07-31  7:51 ` Ilias Apalodimas
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2023-07-30 11:05 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: u-boot, Heinrich Schuchardt

Don't leak newlist if we error out.

Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_memory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 45d3bf52b8..ebf4a2d5fa 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -324,6 +324,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
 				 * The user requested to only have RAM overlaps,
 				 * but we hit a non-RAM region. Error out.
 				 */
+				free(newlist);
 				return EFI_NO_MAPPING;
 			case EFI_CARVE_NO_OVERLAP:
 				/* Just ignore this list entry */
@@ -354,6 +355,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
 		 * The payload wanted to have RAM overlaps, but we overlapped
 		 * with an unallocated region. Error out.
 		 */
+		free(newlist);
 		return EFI_NO_MAPPING;
 	}
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] efi_loader: memory leak efi_add_memory_map_pg
  2023-07-30 11:05 [PATCH 1/1] efi_loader: memory leak efi_add_memory_map_pg Heinrich Schuchardt
@ 2023-07-31  7:51 ` Ilias Apalodimas
  0 siblings, 0 replies; 2+ messages in thread
From: Ilias Apalodimas @ 2023-07-31  7:51 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: u-boot

On Sun, 30 Jul 2023 at 14:05, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Don't leak newlist if we error out.
>
> Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/efi_memory.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index 45d3bf52b8..ebf4a2d5fa 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -324,6 +324,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
>                                  * The user requested to only have RAM overlaps,
>                                  * but we hit a non-RAM region. Error out.
>                                  */
> +                               free(newlist);
>                                 return EFI_NO_MAPPING;
>                         case EFI_CARVE_NO_OVERLAP:
>                                 /* Just ignore this list entry */
> @@ -354,6 +355,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
>                  * The payload wanted to have RAM overlaps, but we overlapped
>                  * with an unallocated region. Error out.
>                  */
> +               free(newlist);
>                 return EFI_NO_MAPPING;
>         }
>
> --
> 2.40.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-31  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-30 11:05 [PATCH 1/1] efi_loader: memory leak efi_add_memory_map_pg Heinrich Schuchardt
2023-07-31  7:51 ` Ilias Apalodimas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.