Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305875

[PATCH 1/2] soc: versatile: Add missing kfree in error path

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH 1/2] soc: versatile: Add missing kfree in error path
Date 2016-01-11 07:30 +0100
Message-ID <qPE9j-6Vv-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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@wanadoo.fr>
---
This patch has already been
   Acked-by: Linus Walleij <linus.walleij@linaro.org>
on 17/07/2015
---
 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 c337764..39ffe18 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -113,8 +113,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.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] soc: versatile: Add missing kfree in error path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-01-11 07:30 +0100
  [PATCH 2/2] soc: versatile: Drop a useless static qualifier Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-01-11 07:30 +0100
    Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-12 12:50 +0100
    Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier Linus Walleij <linus.walleij@linaro.org> - 2016-01-14 10:20 +0100

csiph-web