staging: greybus: light: Release memory obtained by kasprintf
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Sat, 23 Sep 2017 07:55:30 +0000 (13:25 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Sep 2017 13:39:22 +0000 (15:39 +0200)
Free memory region, if gb_lights_channel_config is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/light.c

index 3f4148c..0f538b8 100644 (file)
@@ -925,6 +925,8 @@ static void __gb_lights_led_unregister(struct gb_channel *channel)
                return;
 
        led_classdev_unregister(cdev);
+       kfree(cdev->name);
+       cdev->name = NULL;
        channel->led = NULL;
 }