From: Sachin Kamat Date: Tue, 25 Sep 2012 07:11:40 +0000 (+0530) Subject: pinctrl: Fix potential memory leak in pinctrl_register_one_pin() X-Git-Tag: v3.12-rc1~2272^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb26cc9c71f81f44777bbf5ca1bd72aa76997786;p=kernel%2Fkernel-generic.git 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 Signed-off-by: Linus Walleij --- 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; }