From: Oleksij Rempel <linux@rempel-privat.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <linux@rempel-privat.de>
Subject: [PATCH v1 3/5] video/ssd1307fb: fix potential memory leak on error
Date: Sat, 10 Nov 2018 08:59:52 +0100 [thread overview]
Message-ID: <20181110075954.32746-4-linux@rempel-privat.de> (raw)
In-Reply-To: <20181110075954.32746-1-linux@rempel-privat.de>
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
drivers/video/ssd1307fb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index d68f0c505..1fd1a3cfb 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -548,8 +548,11 @@ static int ssd1307fb_probe(struct device_d *dev)
/* clear display */
array = ssd1307fb_alloc_array(par->width * par->height / 8,
SSD1307FB_DATA);
- if (!array)
- return -ENOMEM;
+ if (!array) {
+ dev_err(&client->dev, "Couldn't not allocate an array\n");
+ ret = -ENOMEM;
+ goto panel_init_error;
+ }
for (i = 0; i < (par->height / 8); i++) {
for (j = 0; j < par->width; j++) {
@@ -569,6 +572,7 @@ static int ssd1307fb_probe(struct device_d *dev)
panel_init_error:
reset_oled_error:
+ free(vmem);
fb_alloc_error:
regulator_disable(par->vbat);
free(info);
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-11-10 8:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-10 7:59 [PATCH v1 0/5] random fixes Oleksij Rempel
2018-11-10 7:59 ` [PATCH v1 1/5] commands: keystore: init s_len Oleksij Rempel
2018-11-12 7:34 ` Sascha Hauer
2018-11-10 7:59 ` [PATCH v1 2/5] ddr_spd: remove unused array Oleksij Rempel
2018-11-10 7:59 ` Oleksij Rempel [this message]
2018-11-16 7:52 ` [PATCH v1 3/5] video/ssd1307fb: fix potential memory leak on error Sascha Hauer
2018-11-10 7:59 ` [PATCH v1 4/5] clk: imx: cpu: avoid use after free " Oleksij Rempel
2018-11-12 7:36 ` Sascha Hauer
2018-11-10 7:59 ` [PATCH v1 5/5] of: partition: set ret for error cases Oleksij Rempel
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=20181110075954.32746-4-linux@rempel-privat.de \
--to=linux@rempel-privat.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