mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: staging: greybus: Release memory obtained by kasprintf
@ 2017-09-21 11:35 Arvind Yadav
  2017-09-21 12:59 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Arvind Yadav @ 2017-09-21 11:35 UTC (permalink / raw)
  To: rmfrfs, johan, elder, gregkh; +Cc: greybus-dev, devel, linux-kernel

Free memory region, if gb_lights_channel_config is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-21 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 11:35 [PATCH] media: staging: greybus: Release memory obtained by kasprintf Arvind Yadav
2017-09-21 12:59 ` Dan Carpenter
2017-09-21 13:54   ` Rui Miguel Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®