mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Daniel Mierswa <d.mierswa@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/4] graphic_utils: always initialize offscreenbuf member
Date: Mon, 14 Jan 2013 02:54:16 +0100	[thread overview]
Message-ID: <315822d6c1eb34af01e0047077f6fd1855dc6265.1358127379.git.d.mierswa@phytec.de> (raw)
In-Reply-To: <cover.1358127379.git.d.mierswa@phytec.de>
In-Reply-To: <cover.1358127379.git.d.mierswa@phytec.de>

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;
 	}
 
 	return sc->fd;
-- 
1.8.1


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

  parent reply	other threads:[~2013-01-14  1:54 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 ` Daniel Mierswa [this message]
2013-01-14 14:30   ` [PATCH 4/4] graphic_utils: always initialize offscreenbuf member Jean-Christophe PLAGNIOL-VILLARD

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=315822d6c1eb34af01e0047077f6fd1855dc6265.1358127379.git.d.mierswa@phytec.de \
    --to=d.mierswa@phytec.de \
    --cc=barebox@lists.infradead.org \
    /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