[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1348557100-16972-1-git-send-email-sachin.kamat@linaro.org>
Date: Tue, 25 Sep 2012 12:41:40 +0530
From: Sachin Kamat <sachin.kamat@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: linus.walleij@...aro.org, sachin.kamat@...aro.org,
patches@...aro.org
Subject: [PATCH] pinctrl: Fix potential memory leak in pinctrl_register_one_pin()
'pindesc' was not freed when returning from an error induced
exit path.
Signed-off-by: Sachin Kamat <sachin.kamat@...aro.org>
---
drivers/pinctrl/core.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index dc5c126..0f1ec9e 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -230,8 +230,10 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
pindesc->name = name;
} else {
pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number);
- if (pindesc->name == NULL)
+ if (pindesc->name == NULL) {
+ kfree(pindesc);
return -ENOMEM;
+ }
pindesc->dynamic_name = true;
}
--
1.7.4.1
--
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