From: Daniel Mierswa <d.mierswa@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/4] video/imx: always initialize offscreenbuf member
Date: Thu, 17 Jan 2013 07:32:59 +0100 [thread overview]
Message-ID: <6bf1089855588c8d227009989b54c826ac8e245e.1358400153.git.d.mierswa@phytec.de> (raw)
In-Reply-To: <cover.1358400153.git.d.mierswa@phytec.de>
In-Reply-To: <cover.1358400153.git.d.mierswa@phytec.de>
If offscreen was not passed to fd_open the resulting offscreenbuf
member 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>
---
commands/splash.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/commands/splash.c b/commands/splash.c
index 4cc463e..75c7074 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -59,6 +59,14 @@ static int do_splash(int argc, char *argv[])
return 1;
}
+ /*
+ * sc.offscreenbuf is dangling here, if no offscreen buffer was
+ * requested, so set it to NULL otherwise the free in fd_close
+ * will cause undefined behaviour
+ */
+ if (!offscreen)
+ sc.offscreenbuf = NULL;
+
if (sc.offscreenbuf) {
if (do_bg)
memset_pixel(&info, sc.offscreenbuf, bg_color,
--
1.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-01-17 6:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 6:32 [RESEND PATCH] framebuffer work (especially i.MX) Daniel Mierswa
2013-01-17 6:32 ` [PATCH 1/4] i.MX21: Add periph. clock register name macros Daniel Mierswa
2013-01-17 6:32 ` [PATCH 2/4] i.MX21/27: don't enable lcd bus clocks too early Daniel Mierswa
2013-01-17 6:32 ` [PATCH 3/4] i.MX27: fix shift amount for PCCR1_PERCLK3_EN Daniel Mierswa
2013-01-17 6:32 ` Daniel Mierswa [this message]
2013-01-17 11:56 ` [PATCH 4/4] video/imx: always initialize offscreenbuf member Jean-Christophe PLAGNIOL-VILLARD
2013-01-17 13:04 ` Daniel Mierswa
2013-01-17 17:55 ` Sascha Hauer
2013-01-18 4:24 ` Daniel Mierswa
2013-01-18 10:23 ` [RESEND PATCH] framebuffer work (especially i.MX) Sascha Hauer
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=6bf1089855588c8d227009989b54c826ac8e245e.1358400153.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