All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.