[PATCH v2 2/4] video/ssd1307fb: fix potential memory leak on error

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

 



Signed-off-by: Oleksij Rempel <linux@xxxxxxxxxxxxxxxx>
---
 drivers/video/ssd1307fb.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index d68f0c505..70077e43a 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -548,8 +548,10 @@ 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) {
+		ret = -ENOMEM;
+		goto panel_init_error;
+	}
 
 	for (i = 0; i < (par->height / 8); i++) {
 		for (j = 0; j < par->width; j++) {
@@ -569,6 +571,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@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