From 0f6a63a0099dc7650ff4353ca1a18946a6804edb Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 25 Sep 2012 12:41:40 +0530 Subject: [PATCH] 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 --- drivers/pinctrl/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.39.5