linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: keembay: fix memleak in keembay_build_functions()
@ 2022-11-29 11:31 Rafał Miłecki
  0 siblings, 0 replies; only message in thread
From: Rafał Miłecki @ 2022-11-29 11:31 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lakshmi Sowjanya D, linux-gpio, Gaosheng Cui,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Add missing kfree().

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
This is NOT run-time tested, Lakshmi would you like to test it first?
---
 drivers/pinctrl/pinctrl-keembay.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 152c35bce8ec..51b684201b20 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -1599,6 +1599,7 @@ static int keembay_add_functions(struct keembay_pinctrl *kpc,
 static int keembay_build_functions(struct keembay_pinctrl *kpc)
 {
 	struct function_desc *keembay_funcs, *new_funcs;
+	int err;
 	int i;
 
 	/*
@@ -1643,7 +1644,11 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
 		return -ENOMEM;
 	}
 
-	return keembay_add_functions(kpc, new_funcs);
+	err = keembay_add_functions(kpc, new_funcs);
+
+	kfree(new_funcs);
+
+	return err;
 }
 
 static const struct keembay_pin_soc keembay_data = {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-29 11:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-29 11:31 [PATCH] pinctrl: keembay: fix memleak in keembay_build_functions() Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).