From: Takashi Iwai Date: Thu, 3 Dec 2009 09:14:10 +0000 (+0100) Subject: ALSA: hda - Fix memory leaks in the previous patch X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ac2c92e0cd06387ecee8115f5fa385fba6413c42;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 --- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 98e117bac90..d967836f36b 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) if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ kfree(codec->chip_name); codec->chip_name = kstrdup("ALC259", GFP_KERNEL); - if (!codec->chip_name) + if (!codec->chip_name) { + alc_free(codec); return -ENOMEM; + } } board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, @@ -17465,8 +17467,10 @@ static int patch_alc662(struct hda_codec *codec) if (alc_read_coef_idx(codec, 0)==0x8020){ kfree(codec->chip_name); codec->chip_name = kstrdup("ALC661", GFP_KERNEL); - if (!codec->chip_name) + if (!codec->chip_name) { + alc_free(codec); return -ENOMEM; + } } board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, @@ -17540,13 +17544,13 @@ static int patch_alc888(struct hda_codec *codec) if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ kfree(codec->chip_name); codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); - if (!codec->chip_name) + if (!codec->chip_name) { + alc_free(codec); return -ENOMEM; - patch_alc662(codec); - } else { - patch_alc882(codec); + } + return patch_alc662(codec); } - return 0; + return patch_alc882(codec); } /*