Skip to content

Commit

Permalink
pinctrl: Fix potential memory leak in pinctrl_register_one_pin()
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
Sachin Kamat authored and Linus Walleij committed Sep 27, 2012
1 parent 4c85472 commit eb26cc9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit eb26cc9

Please sign in to comment.