Re: [PATCH 4/4] graphic_utils: always initialize offscreenbuf member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02:54 Mon 14 Jan     , Daniel Mierswa wrote:
> If offscreen was not passed to the function the resulting
> offscreenbuf was a dangling pointer and the free() call
> in fd_close would result in undefined behaviour.
> 
> Signed-off-by: Daniel Mierswa <d.mierswa@xxxxxxxxx>
> ---
>  lib/gui/graphic_utils.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
> index 3800ee2..79200de 100644
> --- a/lib/gui/graphic_utils.c
> +++ b/lib/gui/graphic_utils.c
> @@ -226,6 +226,8 @@ int fb_open(const char * fbdev, struct screen *sc, bool offscreen)
>  		 * on the framebuffer
>  		 */
>  		sc->offscreenbuf = malloc(sc->fbsize);
> +	} else {
> +		sc->offscreenbuf = NULL;
>  	}
no you do not touch the struct if we do not ask you a offscreen

the one that call fb_open need to init the struct screen

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux