Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: LuMingYin <lumingyindetect@163.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	perex@perex.cz, tiwai@suse.com, minhuadotchen@gmail.com
Subject: Re: [PATCH] sound:Fix a memory leak in snd_ctl_elem_add_compat function
Date: Sat, 23 Mar 2024 10:31:08 +0100	[thread overview]
Message-ID: <87jzltxpk3.wl-tiwai@suse.de> (raw)
In-Reply-To: <20240323092712.685675-1-lumingyindetect@163.com>

On Sat, 23 Mar 2024 10:27:12 +0100,
LuMingYin wrote:
> 
> In the function snd_ctl_elem_add_compat defined in /linux/sound/core/control_compat.c, a pointer named data is declared. This pointer allocates a block of dynamic memory using the kzalloc function at line 354. When the if statement at line 355 returns false, it indicates successful allocation of the dynamic memory area pointed to by data. However, when the if statements at lines 359 or 362 are true, the program will not execute the snd_ctl_elem_add(file, data, replace); operation at line 389 and will return directly. During this process, the dynamic memory area pointed to by data is neither freed nor used, leading to a memory leak bug. This commit fixes the aforementioned memory leak issue.
> 
> Signed-off-by: LuMingYin <lumingyindetect@163.com>

Ditto as another mail, it's automatically freed.


Takashi

      reply	other threads:[~2024-03-23  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23  9:27 [PATCH] sound:Fix a memory leak in snd_ctl_elem_add_compat function LuMingYin
2024-03-23  9:31 ` Takashi Iwai [this message]

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=87jzltxpk3.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lumingyindetect@163.com \
    --cc=minhuadotchen@gmail.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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