mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpio: fix memory leak in error path
@ 2013-11-13 20:20 Michal Nazarewicz
  2013-11-19  8:24 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Nazarewicz @ 2013-11-13 20:20 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel

From: Michal Nazarewicz <mina86@mina86.com>

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/gpio/gpiolib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4e10b10..068011c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1341,8 +1341,10 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip,
 	ret = pinctrl_get_group_pins(pctldev, pin_group,
 					&pin_range->range.pins,
 					&pin_range->range.npins);
-	if (ret < 0)
+	if (ret < 0) {
+		kfree(pin_range);
 		return ret;
+	}
 
 	pinctrl_add_gpio_range(pctldev, &pin_range->range);
 
-- 
1.8.4.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-19  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13 20:20 [PATCH] gpio: fix memory leak in error path Michal Nazarewicz
2013-11-19  8:24 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®