[alsa-devel] [PATCH] ALSA: hda - Fix memory leak on snd_hdac_device_init error

Guneshwor Singh guneshwor.o.singh at intel.com
Thu Nov 9 04:27:51 CET 2017


From: "Subhransu S. Prusty" <subhransu.s.prusty at intel.com>

Free codec vendor name on snd_hdac_device_init error.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty at intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh at intel.com>
---
 sound/hda/hdac_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 19deb306facb..467b949544e2 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -111,6 +111,8 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,
 	return 0;
 
  error:
+	kfree(codec->vendor_name);
+
 	put_device(&codec->dev);
 	return err;
 }
-- 
2.15.0



More information about the Alsa-devel mailing list