mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Daniel Mierswa <d.mierswa@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/4] graphic_utils: always initialize offscreenbuf member
Date: Mon, 14 Jan 2013 15:30:51 +0100	[thread overview]
Message-ID: <20130114143051.GC22953@game.jcrosoft.org> (raw)
In-Reply-To: <315822d6c1eb34af01e0047077f6fd1855dc6265.1358127379.git.d.mierswa@phytec.de>

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@phytec.de>
> ---
>  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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-01-14 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14  1:54 [PATCH] framebuffer work (especially i.MX) Daniel Mierswa
2013-01-14  1:54 ` [PATCH 1/4] i.MX21: Add periph. clock register name macros Daniel Mierswa
2013-01-14  1:54 ` [PATCH 2/4] i.MX21/27: don't enable lcd bus clocks too early Daniel Mierswa
2013-01-14 10:09   ` Sascha Hauer
2013-01-14  1:54 ` [PATCH 3/4] i.MX27: fix shift amount for PCCR1_PERCLK3_EN Daniel Mierswa
2013-01-14  1:54 ` [PATCH 4/4] graphic_utils: always initialize offscreenbuf member Daniel Mierswa
2013-01-14 14:30   ` Jean-Christophe PLAGNIOL-VILLARD [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130114143051.GC22953@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=d.mierswa@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox