[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1437155675-29123-1-git-send-email-christophe.jaillet@wanadoo.fr>
Date: Fri, 17 Jul 2015 19:54:35 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: linus.walleij@...aro.org, arnd@...db.de
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] soc: versatile: Add missing kfree in error path
If 'of_property_read_string' fails, then 'soc_dev_attr' should be freed,
otherwise, there is a memory leak.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/soc/versatile/soc-realview.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index e642c45..48bc962 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -109,8 +109,10 @@ static int realview_soc_probe(struct platform_device *pdev)
ret = of_property_read_string(np, "compatible",
&soc_dev_attr->soc_id);
- if (ret)
+ if (ret) {
+ kfree(soc_dev_attr);
return -EINVAL;
+ }
soc_dev_attr->machine = "RealView";
soc_dev_attr->family = "Versatile";
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists