Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH] ALSA: pci: Fix memory leak in snd_ali_create
@ 2019-10-27 18:30 Navid Emamdoost
  2019-10-28  6:32 ` Takashi Iwai
  0 siblings, 1 reply; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2019-10-28  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-27 18:30 [alsa-devel] [PATCH] ALSA: pci: Fix memory leak in snd_ali_create Navid Emamdoost
2019-10-28  6:32 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox