summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-08-11 12:01:19 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-31 14:51:52 -0700
commitcd6541c03d0777963615d00b22ff8a4c8ee8d601 (patch)
tree3b79895f6dd8b9c31746fe9501b2d95694ac0ae0 /drivers
parentc2c6a66a51da4d7311aa4508c1cd56c2397cf708 (diff)
downloadlinux-3.10-cd6541c03d0777963615d00b22ff8a4c8ee8d601.tar.gz
linux-3.10-cd6541c03d0777963615d00b22ff8a4c8ee8d601.tar.bz2
linux-3.10-cd6541c03d0777963615d00b22ff8a4c8ee8d601.zip
staging: tm6000: fix memory leak
Original code doesn't call kfree(chip) on error. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/tm6000/tm6000-alsa.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index 087137d9164..6c09ef3c71e 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -403,7 +403,7 @@ int tm6000_audio_init(struct tm6000_core *dev)
rc = snd_pcm_new(card, "TM6000 Audio", 0, 0, 1, &pcm);
if (rc < 0)
- goto error;
+ goto error_chip;
pcm->info_flags = 0;
pcm->private_data = chip;
@@ -413,12 +413,15 @@ int tm6000_audio_init(struct tm6000_core *dev)
rc = snd_card_register(card);
if (rc < 0)
- goto error;
+ goto error_chip;
dprintk(1,"Registered audio driver for %s\n", card->longname);
return 0;
+error_chip:
+ kfree(chip);
+ dev->adev = NULL;
error:
snd_card_free(card);
return rc;