Skip to contentSkip to conversation

ALSA: hda: cs35l41: fix double free on error in probe()

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 11, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda: cs35l41: fix double free on error in probe()

If we encounter an error after the kfree(acpi_hw_cfg); then the goto err; will result in a double free.

Fixes 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
---
 sound/pci/hda/cs35l41_hda.c | 1 +
 1 file changed, 1 insertion(+)
sound/pci/hda/cs35l41_hda.c +1 -0
index aa5bb6977792..30b40d865863 100644
@@ -477,6 +477,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
 	if (ret)
 		goto err;
 	kfree(acpi_hw_cfg);
+	acpi_hw_cfg = NULL;
 
 	if (cs35l41->reg_seq->probe) {
 		ret = regmap_register_patch(cs35l41->regmap, cs35l41->reg_seq->probe,
Signature · 1 line
2.20.1
Applied
#1 lore raw
Quoted 6 lines · Dan Carpenter

If we encounter an error after the kfree(acpi_hw_cfg); then the goto err; will result in a double free.

Fixes 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")

Thanks, applied now.

Takashi