* [PATCH] ALSA: pci: Fix memory leak in snd_ali_create
@ 2019-10-27 18:30 ` Navid Emamdoost
0 siblings, 0 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-27 18:30 UTC (permalink / raw)
Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Jaroslav Kysela,
Takashi Iwai, Thomas Gleixner, Richard Fontana, alsa-devel,
linux-kernel
In the implementation of snd_ali_create() the memory allocated for codec
is leaked in case of an error. Release codec if snd_ali_chip_init()
fails.
Fixes: f9ab2b1c3ab5 ("[ALSA] ali5451 - Code clean up, irq handler fix")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
sound/pci/ali5451/ali5451.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 6e28e381c21a..3ed07a18be4d 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2179,6 +2179,7 @@ static int snd_ali_create(struct snd_card *card,
err = snd_ali_chip_init(codec);
if (err < 0) {
dev_err(card->dev, "ali create: chip init error.\n");
+ snd_ali_free(codec);
return err;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [alsa-devel] [PATCH] ALSA: pci: Fix memory leak in snd_ali_create
@ 2019-10-27 18:30 ` Navid Emamdoost
0 siblings, 0 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-27 18:30 UTC (permalink / raw)
Cc: alsa-devel, linux-kernel, kjlu, Takashi Iwai, Richard Fontana,
emamd001, smccaman, Thomas Gleixner, Navid Emamdoost
In the implementation of snd_ali_create() the memory allocated for codec
is leaked in case of an error. Release codec if snd_ali_chip_init()
fails.
Fixes: f9ab2b1c3ab5 ("[ALSA] ali5451 - Code clean up, irq handler fix")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
sound/pci/ali5451/ali5451.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 6e28e381c21a..3ed07a18be4d 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2179,6 +2179,7 @@ static int snd_ali_create(struct snd_card *card,
err = snd_ali_chip_init(codec);
if (err < 0) {
dev_err(card->dev, "ali create: chip init error.\n");
+ snd_ali_free(codec);
return err;
}
--
2.17.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: pci: Fix memory leak in snd_ali_create
2019-10-27 18:30 ` [alsa-devel] " Navid Emamdoost
@ 2019-10-28 6:32 ` Takashi Iwai
-1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-10-28 6:32 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Jaroslav Kysela, Takashi Iwai,
Thomas Gleixner, Richard Fontana, alsa-devel, linux-kernel
On Sun, 27 Oct 2019 19:30:27 +0100,
Navid Emamdoost wrote:
>
> In the implementation of snd_ali_create() the memory allocated for codec
> is leaked in case of an error. Release codec if snd_ali_chip_init()
> fails.
Once again, this is a wrong fix. The code path is after
snd_device_new() with the free op, so the object gets already released
there.
thanks,
Takashi
>
> Fixes: f9ab2b1c3ab5 ("[ALSA] ali5451 - Code clean up, irq handler fix")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> sound/pci/ali5451/ali5451.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
> index 6e28e381c21a..3ed07a18be4d 100644
> --- a/sound/pci/ali5451/ali5451.c
> +++ b/sound/pci/ali5451/ali5451.c
> @@ -2179,6 +2179,7 @@ static int snd_ali_create(struct snd_card *card,
> err = snd_ali_chip_init(codec);
> if (err < 0) {
> dev_err(card->dev, "ali create: chip init error.\n");
> + snd_ali_free(codec);
> return err;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA: pci: Fix memory leak in snd_ali_create
@ 2019-10-28 6:32 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-10-28 6:32 UTC (permalink / raw)
To: Navid Emamdoost
Cc: alsa-devel, linux-kernel, kjlu, Takashi Iwai, Richard Fontana,
emamd001, smccaman, Thomas Gleixner
On Sun, 27 Oct 2019 19:30:27 +0100,
Navid Emamdoost wrote:
>
> In the implementation of snd_ali_create() the memory allocated for codec
> is leaked in case of an error. Release codec if snd_ali_chip_init()
> fails.
Once again, this is a wrong fix. The code path is after
snd_device_new() with the free op, so the object gets already released
there.
thanks,
Takashi
>
> Fixes: f9ab2b1c3ab5 ("[ALSA] ali5451 - Code clean up, irq handler fix")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> sound/pci/ali5451/ali5451.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
> index 6e28e381c21a..3ed07a18be4d 100644
> --- a/sound/pci/ali5451/ali5451.c
> +++ b/sound/pci/ali5451/ali5451.c
> @@ -2179,6 +2179,7 @@ static int snd_ali_create(struct snd_card *card,
> err = snd_ali_chip_init(codec);
> if (err < 0) {
> dev_err(card->dev, "ali create: chip init error.\n");
> + snd_ali_free(codec);
> return err;
> }
>
> --
> 2.17.1
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-28 7:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 18:30 [PATCH] ALSA: pci: Fix memory leak in snd_ali_create Navid Emamdoost
2019-10-27 18:30 ` [alsa-devel] " Navid Emamdoost
2019-10-28 6:32 ` Takashi Iwai
2019-10-28 6:32 ` [alsa-devel] " Takashi Iwai
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.