aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2012-04-12 16:11:25 -0400
committerTakashi Iwai <tiwai@suse.de>2012-04-13 01:35:57 -0400
commit7d7eb9ea314e992413620610b4d09c9cd5fa8959 (patch)
tree159a2cc18ad80868af18d7a0675a940c457e1536 /sound
parent29ebe40284c75a5888c601872059fca7e258528d (diff)
ALSA: hda/realtek - Fix mem leak (and rid us of trailing whitespace).
In sound/pci/hda/patch_realtek.c::alc_auto_fill_dac_nids(), in the 'for (;;)' loop, if the 'badness' value returned from fill_and_eval_dacs() is negative, then we'll return from the function without freeing the memory we allocated for 'best_cfg', thus leaking. Fix the leak by kfree()'ing the memory when badness is negative. While I was there I also noticed some trailing whitespace in the function that I removed (along with all other trailing whitespace in the file) - it didn't seem worth-while to do that as two patches, so I hope it's OK that I just did it all as one patch. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8f4a48463fad..2508f8109f11 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3398,8 +3398,10 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3398 for (;;) { 3398 for (;;) {
3399 badness = fill_and_eval_dacs(codec, fill_hardwired, 3399 badness = fill_and_eval_dacs(codec, fill_hardwired,
3400 fill_mio_first); 3400 fill_mio_first);
3401 if (badness < 0) 3401 if (badness < 0) {
3402 kfree(best_cfg);
3402 return badness; 3403 return badness;
3404 }
3403 debug_badness("==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n", 3405 debug_badness("==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n",
3404 cfg->line_out_type, fill_hardwired, fill_mio_first, 3406 cfg->line_out_type, fill_hardwired, fill_mio_first,
3405 badness); 3407 badness);
@@ -3434,7 +3436,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3434 cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; 3436 cfg->line_out_type = AUTO_PIN_SPEAKER_OUT;
3435 fill_hardwired = true; 3437 fill_hardwired = true;
3436 continue; 3438 continue;
3437 } 3439 }
3438 if (cfg->hp_outs > 0 && 3440 if (cfg->hp_outs > 0 &&
3439 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { 3441 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
3440 cfg->speaker_outs = cfg->line_outs; 3442 cfg->speaker_outs = cfg->line_outs;
@@ -3448,7 +3450,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3448 cfg->line_out_type = AUTO_PIN_HP_OUT; 3450 cfg->line_out_type = AUTO_PIN_HP_OUT;
3449 fill_hardwired = true; 3451 fill_hardwired = true;
3450 continue; 3452 continue;
3451 } 3453 }
3452 break; 3454 break;
3453 } 3455 }
3454 3456
@@ -4423,7 +4425,7 @@ static int alc_parse_auto_config(struct hda_codec *codec,
4423static int alc880_parse_auto_config(struct hda_codec *codec) 4425static int alc880_parse_auto_config(struct hda_codec *codec)
4424{ 4426{
4425 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 4427 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4426 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; 4428 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
4427 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); 4429 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
4428} 4430}
4429 4431
@@ -6093,7 +6095,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6093 * Basically the device should work as is without the fixup table. 6095 * Basically the device should work as is without the fixup table.
6094 * If BIOS doesn't give a proper info, enable the corresponding 6096 * If BIOS doesn't give a proper info, enable the corresponding
6095 * fixup entry. 6097 * fixup entry.
6096 */ 6098 */
6097 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 6099 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6098 ALC269_FIXUP_AMIC), 6100 ALC269_FIXUP_AMIC),
6099 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), 6101 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
@@ -6310,7 +6312,7 @@ static void alc_fixup_no_jack_detect(struct hda_codec *codec,
6310{ 6312{
6311 if (action == ALC_FIXUP_ACT_PRE_PROBE) 6313 if (action == ALC_FIXUP_ACT_PRE_PROBE)
6312 codec->no_jack_detect = 1; 6314 codec->no_jack_detect = 1;
6313} 6315}
6314 6316
6315static const struct alc_fixup alc861_fixups[] = { 6317static const struct alc_fixup alc861_fixups[] = {
6316 [ALC861_FIXUP_FSC_AMILO_PI1505] = { 6318 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
@@ -6728,7 +6730,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6728 * Basically the device should work as is without the fixup table. 6730 * Basically the device should work as is without the fixup table.
6729 * If BIOS doesn't give a proper info, enable the corresponding 6731 * If BIOS doesn't give a proper info, enable the corresponding
6730 * fixup entry. 6732 * fixup entry.
6731 */ 6733 */
6732 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), 6734 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
6733 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), 6735 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
6734 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), 6736 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),