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>
This commit is contained in:
Sachin Kamat 2012-09-25 12:41:40 +05:30 коммит произвёл Linus Walleij
Родитель 4c854723c8
Коммит eb26cc9c71
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -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;
}