[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] gfxmenu/gui_image.c: Fix double free of bitmap
From: |
Daniel Kiper |
Subject: |
Re: [PATCH] gfxmenu/gui_image.c: Fix double free of bitmap |
Date: |
Thu, 14 Dec 2023 19:25:55 +0100 |
On Wed, Dec 13, 2023 at 10:25:13PM +0000, Alec Brown wrote:
> In grub-core/gfxmenu/gui_image.c, coverity detected a double free in the
> function load_image(). The function checks if self->bitmap and
> self->raw_bitmap
> aren't NULL and then frees them. In the case self->bitmap and self->raw_bitmap
> are the same, only self->raw_bitmap is freed which would also free the memory
> used by self->bitmap. However, in this case self->bitmap isn't being set to
> NULL
> which could lead to a double free later in the code. After self->raw_bitmap is
> freed, it gets set to the variable bitmap. If this variable is NULL, the code
> could have a path that would free self->bitmap a second time in the function
> rescale_image().
>
> Fixes: CID 292472
>
> Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel