diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-09-25 03:11:40 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-09-27 07:43:14 -0400 |
commit | eb26cc9c71f81f44777bbf5ca1bd72aa76997786 (patch) | |
tree | af7b8314a9b325b7b13f7adda05a9739dc8d4089 | |
parent | 4c854723c8bea457d3418ea2f398b6cfbcb3988e (diff) |
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@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | 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 dc5c126e398a..0f1ec9e8ff14 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, | |||
230 | pindesc->name = name; | 230 | pindesc->name = name; |
231 | } else { | 231 | } else { |
232 | pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number); | 232 | pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number); |
233 | if (pindesc->name == NULL) | 233 | if (pindesc->name == NULL) { |
234 | kfree(pindesc); | ||
234 | return -ENOMEM; | 235 | return -ENOMEM; |
236 | } | ||
235 | pindesc->dynamic_name = true; | 237 | pindesc->dynamic_name = true; |
236 | } | 238 | } |
237 | 239 | ||