[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190819211611.GA13437@amd>
Date: Mon, 19 Aug 2019 23:16:11 +0200
From: Pavel Machek <pavel@....cz>
To: Wenwen Wang <wenwen@...uga.edu>
Cc: Jacek Anaszewski <jacek.anaszewski@...il.com>,
Dan Murphy <dmurphy@...com>,
"open list:LED SUBSYSTEM" <linux-leds@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] led: triggers: Fix a memory leak bug
On Mon 2019-08-19 15:41:42, Wenwen Wang wrote:
> In led_trigger_set(), 'event' is allocated in kasprintf(). However, it is
> not deallocated in the following execution if the label 'err_activate' or
> 'err_add_groups' is entered, leading to memory leaks. To fix this issue,
> free 'event' before returning the error.
>
> Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
Acked-by: Pavel Machek <pavel@....cz>
> +++ b/drivers/leds/led-triggers.c
> @@ -173,6 +173,7 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
> list_del(&led_cdev->trig_list);
> write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags);
> led_set_brightness(led_cdev, LED_OFF);
> + kfree(event);
>
> return ret;
> }
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists