diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-12-03 04:14:10 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-03 04:14:10 -0500 |
commit | ac2c92e0cd06387ecee8115f5fa385fba6413c42 (patch) | |
tree | 8ac242b237b95a70f6773d6a28871ae609ebd2bf /sound | |
parent | 274693f37090ada2cadd09944ab883f05ea6ebe6 (diff) |
ALSA: hda - Fix memory leaks in the previous patch
The previous hack for replacing the codec name give memory leaks at
error paths. This patch fixes them.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 98e117bac90a..d967836f36bb 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -13459,8 +13459,10 @@ static int patch_alc269(struct hda_codec *codec) | |||
13459 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | 13459 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
13460 | kfree(codec->chip_name); | 13460 | kfree(codec->chip_name); |
13461 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); | 13461 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); |
13462 | if (!codec->chip_name) | 13462 | if (!codec->chip_name) { |
13463 | alc_free(codec); | ||
13463 | return -ENOMEM; | 13464 | return -ENOMEM; |
13465 | } | ||
13464 | } | 13466 | } |
13465 | 13467 | ||
13466 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | 13468 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
@@ -17465,8 +17467,10 @@ static int patch_alc662(struct hda_codec *codec) | |||
17465 | if (alc_read_coef_idx(codec, 0)==0x8020){ | 17467 | if (alc_read_coef_idx(codec, 0)==0x8020){ |
17466 | kfree(codec->chip_name); | 17468 | kfree(codec->chip_name); |
17467 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); | 17469 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); |
17468 | if (!codec->chip_name) | 17470 | if (!codec->chip_name) { |
17471 | alc_free(codec); | ||
17469 | return -ENOMEM; | 17472 | return -ENOMEM; |
17473 | } | ||
17470 | } | 17474 | } |
17471 | 17475 | ||
17472 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | 17476 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
@@ -17540,13 +17544,13 @@ static int patch_alc888(struct hda_codec *codec) | |||
17540 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | 17544 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
17541 | kfree(codec->chip_name); | 17545 | kfree(codec->chip_name); |
17542 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | 17546 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
17543 | if (!codec->chip_name) | 17547 | if (!codec->chip_name) { |
17548 | alc_free(codec); | ||
17544 | return -ENOMEM; | 17549 | return -ENOMEM; |
17545 | patch_alc662(codec); | 17550 | } |
17546 | } else { | 17551 | return patch_alc662(codec); |
17547 | patch_alc882(codec); | ||
17548 | } | 17552 | } |
17549 | return 0; | 17553 | return patch_alc882(codec); |
17550 | } | 17554 | } |
17551 | 17555 | ||
17552 | /* | 17556 | /* |