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-Url: https://git.stricted.de/?a=commitdiff_plain;h=eb26cc9c71f81f44777bbf5ca1bd72aa76997786;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.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 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; }