[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] legacycfg.c: avoid closing file twice
From: |
Daniel Kiper |
Subject: |
Re: [PATCH] legacycfg.c: avoid closing file twice |
Date: |
Thu, 24 Oct 2024 19:16:25 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Wed, Oct 16, 2024 at 11:54:38AM -0600, Leo Sandoval wrote:
> An Internal (at Red Hat) static soure code scan detected the issue below,
> pointing to an use-after-free scenario so remove the extra file close
> call.
>
> Error: USE_AFTER_FREE (CWE-416):
> grub-2.06/grub-core/commands/legacycfg.c:194: freed_arg:
> "grub_file_close" frees "file".
> grub-2.06/grub-core/commands/legacycfg.c:201: deref_arg: Calling
> "grub_file_close" dereferences freed pointer "file".
> # 199| if (!args)
> # 200| {
> # 201|-> grub_file_close (file);
> # 202| grub_free (suffix);
> # 203| grub_free (entrysrc);
>
> Signed-off-by: Leo Sandoval <lsandova@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel