Commit cd6541c0 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by Greg Kroah-Hartman

staging: tm6000: fix memory leak

Original code doesn't call kfree(chip) on error.
Signed-off-by: default avatarKulikov Vasiliy <segooon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c2c6a66a
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment