Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fa1b6ca authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman
Browse files

intel_th: msu: Fix possible memory leak in mode_store()



'mode' is malloced in mode_store() and should be freed before leaving
from the error handling cases, otherwise it will cause memory leak.

Fixes: 615c164d ("intel_th: msu: Introduce buffer interface")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/lkml/20190801013825.182543-1-weiyongjun1@huawei.com/
Link: https://lore.kernel.org/r/20191028070651.9770-6-alexander.shishkin@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8e3ef7b4
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1852,8 +1852,10 @@ mode_store(struct device *dev, struct device_attribute *attr, const char *buf,
		return -ENOMEM;
		return -ENOMEM;


	i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
	i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
	if (i >= 0)
	if (i >= 0) {
		kfree(mode);
		goto found;
		goto found;
	}


	/* Buffer sinks only work with a usable IRQ */
	/* Buffer sinks only work with a usable IRQ */
	if (!msc->do_irq) {
	if (!msc->do_irq) {