Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725685 > unrolled thread

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

Started byWang YanQing <udknight@gmail.com>
First post2017-09-03 16:20 +0200
Last post2017-09-03 16:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ALSA: hda: Fix forget to free resource in error handling  code path in hda_codec_driver_probe Wang YanQing <udknight@gmail.com> - 2017-09-03 16:20 +0200
    Re: [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe Takashi Iwai <tiwai@suse.de> - 2017-09-03 16:40 +0200

#1725685 — [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe

FromWang YanQing <udknight@gmail.com>
Date2017-09-03 16:20 +0200
Subject[PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
Message-ID<ulDUK-103-1@gated-at.bofh.it>
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 <udknight@gmail.com>
---
 sound/pci/hda/hda_bind.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 6efadbf..f1b1b7e 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -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;
 }
-- 
1.8.5.6.2.g3d8a54e.dirty

[toc] | [next] | [standalone]


#1725687 — Re: [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe

FromTakashi Iwai <tiwai@suse.de>
Date2017-09-03 16:40 +0200
SubjectRe: [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
Message-ID<ulEe6-166-3@gated-at.bofh.it>
In reply to#1725685
On Sun, 03 Sep 2017 16:11:22 +0200,
Wang YanQing wrote:
> 
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web