diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-06-26 08:54:32 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-06-26 08:56:20 -0400 |
commit | ee48df57c920ab876dd8cf0dcfe5b8893b98e934 (patch) | |
tree | b41a7fde822cf3ba5ea05af6640f48d8b645e745 /sound | |
parent | befae82e2906cb7155020876a531b0b8c6c8d8c8 (diff) |
ALSA: hda - Fix memory leaks in Realtek & Conexant codec parsers
When moved to the helper code, forgot to release the verb arrays.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_auto_parser.c | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_auto_parser.h | 10 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 5 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 6e9ef3e25093..f7520b9f909c 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
@@ -618,7 +618,6 @@ int snd_hda_gen_add_verbs(struct hda_gen_spec *spec, | |||
618 | const struct hda_verb *list) | 618 | const struct hda_verb *list) |
619 | { | 619 | { |
620 | const struct hda_verb **v; | 620 | const struct hda_verb **v; |
621 | snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8); | ||
622 | v = snd_array_new(&spec->verbs); | 621 | v = snd_array_new(&spec->verbs); |
623 | if (!v) | 622 | if (!v) |
624 | return -ENOMEM; | 623 | return -ENOMEM; |
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h index 2a7889dfbd1b..632ad0ad3007 100644 --- a/sound/pci/hda/hda_auto_parser.h +++ b/sound/pci/hda/hda_auto_parser.h | |||
@@ -157,4 +157,14 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
157 | const struct snd_pci_quirk *quirk, | 157 | const struct snd_pci_quirk *quirk, |
158 | const struct hda_fixup *fixlist); | 158 | const struct hda_fixup *fixlist); |
159 | 159 | ||
160 | static inline void snd_hda_gen_init(struct hda_gen_spec *spec) | ||
161 | { | ||
162 | snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8); | ||
163 | } | ||
164 | |||
165 | static inline void snd_hda_gen_free(struct hda_gen_spec *spec) | ||
166 | { | ||
167 | snd_array_free(&spec->verbs); | ||
168 | } | ||
169 | |||
160 | #endif /* __SOUND_HDA_AUTO_PARSER_H */ | 170 | #endif /* __SOUND_HDA_AUTO_PARSER_H */ |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 2af0868f78ad..2bf99fc1cbf2 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -445,8 +445,10 @@ static int conexant_init(struct hda_codec *codec) | |||
445 | 445 | ||
446 | static void conexant_free(struct hda_codec *codec) | 446 | static void conexant_free(struct hda_codec *codec) |
447 | { | 447 | { |
448 | struct conexant_spec *spec = codec->spec; | ||
449 | snd_hda_gen_free(&spec->gen); | ||
448 | snd_hda_detach_beep_device(codec); | 450 | snd_hda_detach_beep_device(codec); |
449 | kfree(codec->spec); | 451 | kfree(spec); |
450 | } | 452 | } |
451 | 453 | ||
452 | static const struct snd_kcontrol_new cxt_capture_mixers[] = { | 454 | static const struct snd_kcontrol_new cxt_capture_mixers[] = { |
@@ -4498,6 +4500,7 @@ static int patch_conexant_auto(struct hda_codec *codec) | |||
4498 | if (!spec) | 4500 | if (!spec) |
4499 | return -ENOMEM; | 4501 | return -ENOMEM; |
4500 | codec->spec = spec; | 4502 | codec->spec = spec; |
4503 | snd_hda_gen_init(&spec->gen); | ||
4501 | 4504 | ||
4502 | switch (codec->vendor_id) { | 4505 | switch (codec->vendor_id) { |
4503 | case 0x14f15045: | 4506 | case 0x14f15045: |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a5534b384609..5ccf10a4d593 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2289,6 +2289,7 @@ static void alc_free(struct hda_codec *codec) | |||
2289 | alc_shutup(codec); | 2289 | alc_shutup(codec); |
2290 | alc_free_kctls(codec); | 2290 | alc_free_kctls(codec); |
2291 | alc_free_bind_ctls(codec); | 2291 | alc_free_bind_ctls(codec); |
2292 | snd_hda_gen_free(&spec->gen); | ||
2292 | kfree(spec); | 2293 | kfree(spec); |
2293 | snd_hda_detach_beep_device(codec); | 2294 | snd_hda_detach_beep_device(codec); |
2294 | } | 2295 | } |
@@ -4253,6 +4254,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) | |||
4253 | return -ENOMEM; | 4254 | return -ENOMEM; |
4254 | codec->spec = spec; | 4255 | codec->spec = spec; |
4255 | spec->mixer_nid = mixer_nid; | 4256 | spec->mixer_nid = mixer_nid; |
4257 | snd_hda_gen_init(&spec->gen); | ||
4256 | 4258 | ||
4257 | err = alc_codec_rename_from_preset(codec); | 4259 | err = alc_codec_rename_from_preset(codec); |
4258 | if (err < 0) { | 4260 | if (err < 0) { |