Skip to content

Commit 284b4c9

Browse files
wyqkptiwai
authored andcommitted
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. Signed-off-by: Wang YanQing <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent b06898d commit 284b4c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/pci/hda/hda_bind.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int hda_codec_driver_probe(struct device *dev)
100100
if (patch) {
101101
err = patch(codec);
102102
if (err < 0)
103-
goto error_module;
103+
goto error_module_put;
104104
}
105105

106106
err = snd_hda_codec_build_pcms(codec);
@@ -120,6 +120,9 @@ static int hda_codec_driver_probe(struct device *dev)
120120
return 0;
121121

122122
error_module:
123+
if (codec->patch_ops.free)
124+
codec->patch_ops.free(codec);
125+
error_module_put:
123126
module_put(owner);
124127

125128
error:

0 commit comments

Comments
 (0)