linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Lakshmi Sowjanya D" <lakshmi.sowjanya.d@intel.com>,
	linux-gpio@vger.kernel.org,
	"Gaosheng Cui" <cuigaosheng1@huawei.com>,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH] pinctrl: keembay: fix memleak in keembay_build_functions()
Date: Tue, 29 Nov 2022 12:31:08 +0100	[thread overview]
Message-ID: <20221129113108.17127-1-zajec5@gmail.com> (raw)

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


                 reply	other threads:[~2022-11-29 11:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221129113108.17127-1-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=cuigaosheng1@huawei.com \
    --cc=lakshmi.sowjanya.d@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=rafal@milecki.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).