From: Kulikov Vasiliy Date: Wed, 11 Aug 2010 08:01:19 +0000 (+0400) Subject: staging: tm6000: fix memory leak X-Git-Tag: MMI-PSA29.97-13-9~21907^2~3^2~761 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cd6541c03d0777963615d00b22ff8a4c8ee8d601;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: tm6000: fix memory leak Original code doesn't call kfree(chip) on error. Signed-off-by: Kulikov Vasiliy Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 087137d9164d..6c09ef3c71ea 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;