Alsa-Devel Archive on
 help / color / Atom feed
From: Takashi Sakamoto <>
Subject: [PATCH] ALSA: core: control_led: fix memory leak in snd_ctl_led_set_state()
Date: Sun,  4 Apr 2021 15:40:31 +0900
Message-ID: <> (raw)

When inquired control element is not in led group, snd_ctl_led_set_state()
attempts to add the element into the group, according to function
arguments. Although an memory object is allocated for led instance, it's
left as is without being released.

This commit fixes the memory leak.

Fixes: 22d8de62f11b ("ALSA: control - add generic LED trigger module as the new control layer")
Signed-off-by: Takashi Sakamoto <>
 sound/core/control_led.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/core/control_led.c b/sound/core/control_led.c
index 788fd9e275e0..b97f118cd54e 100644
--- a/sound/core/control_led.c
+++ b/sound/core/control_led.c
@@ -161,6 +161,7 @@ static void snd_ctl_led_set_state(struct snd_card *card, unsigned int access,
 			list_add(&lctl->list, &led->controls);
 			UPDATE_ROUTE(route, snd_ctl_led_get(lctl));
+		kfree(lctl);
 	switch (led->mode) {

             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04  6:40 Takashi Sakamoto [this message]
2021-04-04  8:16 ` Jaroslav Kysela
2021-04-06  1:16   ` Takashi Sakamoto

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:

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

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Alsa-Devel Archive on

Archives are clonable:
	git clone --mirror alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ \
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone