From: Timur Tabi <timur@freescale.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: ASoC: Fix memory leaks for the CS4270 driver
Date: Thu, 04 Sep 2008 10:54:28 -0500 [thread overview]
Message-ID: <48C004B4.2000208@freescale.com> (raw)
In-Reply-To: <s5hd4jko0p2.wl%tiwai@suse.de>
Takashi Iwai wrote:
> - In cs4270_remove(), cs4270_i2c_detach() is called after
> snd_soc_free_pcms(). snd_soc_free_pcms() invokes snd_card_free()
> inside, and this releases the all resources already, including the
> control elements. That is, you free an already-freed item.
I was wondering why so few drivers were calling snd_ctl_remove(). :-)
> Well, looking the code again, you create only one element, and if
> this fails, there is no other remaining element. Thus, there is
> nothing to free there.
True, but I intend on adding more controls in the future, so I want to code to
handle that automatically.
>
> - The way you look for a kcontrol is wrong although it may work in
> practice. A usual way is to remember the kctl and use it for
> removal, or find the kctl via snd_ctl_find_id(), not _numid().
It would be nice if snd_kcontrol_new had a snd_kcontrol *. I could use it to
store the pointer for later deallocation. Would you accept a patch to add that?
> - Your patch merged in the ALSA tree already would conflict with this
> patch. This is a mess, results in the whole rebase of git tree.
What, wait other patch? I based this patch on
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git. It should
apply cleanly on that repo.
> So, I think the code in 2.6.27 tree can stay as is. There is no leak
> in the end. But, we can fix cs4270.c in the latest ALSA tree,
> e.g. add a missing remove callback to release codec->reg_cache.
I'm confused, because I thought I was fixing the latest ALSA tree.
--
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2008-09-04 15:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-03 22:07 [PATCH] ALSA: ASoC: Fix memory leaks for the CS4270 driver Timur Tabi
2008-09-04 7:00 ` Takashi Iwai
2008-09-04 15:54 ` Timur Tabi [this message]
2008-09-04 16:32 ` Takashi Iwai
2008-09-04 18:20 ` Timur Tabi
2008-09-05 6:34 ` Takashi Iwai
2008-09-05 13:45 ` Timur Tabi
2008-09-05 14:09 ` Takashi Iwai
2008-09-05 14:11 ` Timur Tabi
2008-09-05 14:14 ` Takashi Iwai
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=48C004B4.2000208@freescale.com \
--to=timur@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.