Skip to contentSkip to conversation

ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe

PATCH Superseded Wang YanQing 2 participants 2 messages Sep 3, 2017 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe

When hda_codec_driver_probe meet error and return failure, we need to free resource with patch_ops.free, or we will get resource leak.

---
 sound/pci/hda/hda_bind.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/hda_bind.c +2 -0
index 6efadbf..f1b1b7e 100644
@@ -123,6 +123,8 @@ static int hda_codec_driver_probe(struct device *dev)
 	module_put(owner);
 
  error:
+	if (codec->patch_ops.free)
+		codec->patch_ops.free(codec);
 	snd_hda_codec_cleanup_for_unbind(codec);
 	return err;
 }
Signature · 1 line
1.8.5.6.2.g3d8a54e.dirty
#1 lore raw
Quoted 3 lines · Wang YanQing

When hda_codec_driver_probe meet error and return failure, we need to free resource with patch_ops.free, or we will get resource leak.

No, the codec driver is responsible to free resources in its error path.

thanks,

Takashi