diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-09-25 11:11:40 +0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-09-27 15:43:14 +0400 |
commit | eb26cc9c71f81f44777bbf5ca1bd72aa76997786 (patch) | |
tree | af7b8314a9b325b7b13f7adda05a9739dc8d4089 /drivers/pinctrl/core.c | |
parent | 4c854723c8bea457d3418ea2f398b6cfbcb3988e (diff) | |
download | linux-eb26cc9c71f81f44777bbf5ca1bd72aa76997786.tar.xz |
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>
Diffstat (limited to 'drivers/pinctrl/core.c')
-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, 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; } |