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>
This commit is contained in:
parent
274693f370
commit
ac2c92e0cd
1 changed files with 11 additions and 7 deletions
|
@ -13459,9 +13459,11 @@ static int patch_alc269(struct hda_codec *codec)
|
||||||
if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
|
if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
|
||||||
kfree(codec->chip_name);
|
kfree(codec->chip_name);
|
||||||
codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
|
codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
|
||||||
if (!codec->chip_name)
|
if (!codec->chip_name) {
|
||||||
|
alc_free(codec);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
|
board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
|
||||||
alc269_models,
|
alc269_models,
|
||||||
|
@ -17465,9 +17467,11 @@ static int patch_alc662(struct hda_codec *codec)
|
||||||
if (alc_read_coef_idx(codec, 0)==0x8020){
|
if (alc_read_coef_idx(codec, 0)==0x8020){
|
||||||
kfree(codec->chip_name);
|
kfree(codec->chip_name);
|
||||||
codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
|
codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
|
||||||
if (!codec->chip_name)
|
if (!codec->chip_name) {
|
||||||
|
alc_free(codec);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
|
board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
|
||||||
alc662_models,
|
alc662_models,
|
||||||
|
@ -17540,13 +17544,13 @@ static int patch_alc888(struct hda_codec *codec)
|
||||||
if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
|
if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
|
||||||
kfree(codec->chip_name);
|
kfree(codec->chip_name);
|
||||||
codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
|
codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
|
||||||
if (!codec->chip_name)
|
if (!codec->chip_name) {
|
||||||
|
alc_free(codec);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
patch_alc662(codec);
|
|
||||||
} else {
|
|
||||||
patch_alc882(codec);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return patch_alc662(codec);
|
||||||
|
}
|
||||||
|
return patch_alc882(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Reference in a new issue