lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Sep 2017 17:05:27 +0530
From:   Arvind Yadav <arvind.yadav.cs@...il.com>
To:     rmfrfs@...il.com, johan@...nel.org, elder@...nel.org,
        gregkh@...uxfoundation.org
Cc:     greybus-dev@...ts.linaro.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] media: staging: greybus: Release memory obtained by kasprintf

Free memory region, if gb_lights_channel_config is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
 drivers/staging/greybus/light.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index 3f4148c..b00d47c 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -984,7 +984,7 @@ static int gb_lights_channel_config(struct gb_light *light,
 
 	ret = channel_attr_groups_set(channel, cdev);
 	if (ret < 0)
-		return ret;
+		goto err;
 
 	gb_lights_led_operations_set(channel, cdev);
 
@@ -994,15 +994,18 @@ static int gb_lights_channel_config(struct gb_light *light,
 	 * configurations.
 	 */
 	if (!is_channel_flash(channel))
-		return ret;
+		goto err;
 
 	light->has_flash = true;
 
 	ret = gb_lights_channel_flash_config(channel);
 	if (ret < 0)
-		return ret;
+		goto err;
 
 	return ret;
+err:
+	kfree(cdev->name);
+	return ret;
 }
 
 static int gb_lights_light_config(struct gb_lights *glights, u8 id)
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ